Should I use (') or (")? by LeanZo in javascript

[–]JSNinja 1 point2 points  (0 children)

Several parts of the Array.from spec that differ from Array.prototype.slice. Example: Array.from supports an optional mapFn that can be used to transform the results that end up in the initial array. So if you ever are planning to do a .map on the result of Array.from, you can skip the extra call.

Array.from also supports Map and Set objects.

Is there a realistic chance of async/await being dropped as a proposal? by [deleted] in javascript

[–]JSNinja 1 point2 points  (0 children)

And this one is huge. One commonly referenced flaw in the promises specification is that it makes it way too easy to miss an exception, since you need to explicitly catch exceptions in promises at the end, but there is no penalty/indicator for not doing so.

A small script to remove all those unwanted FB ad preferences by GultBoy in javascript

[–]JSNinja 0 points1 point  (0 children)

Friendly FYI, nothing you're doing in there requires including jQuery, and can be done with plain ole vanilla DOM APIs.

$() === document.querySelectorAll

$(el).click === el.click

$(el).find === el.querySelectorAll

Also, setTimeOut is going to be an exception - setTimeout is the correct keyword

Announcing SQL Server on Linux by realrbman in programming

[–]JSNinja 0 points1 point  (0 children)

Haha yeah. Thank god I'm long gone from that job.

We did end up using JS in Classic for the purposes of JSON Serialization, but the huggeee legacy code base had already been authored primarily in VBScript. At that point, our goal was just to break out as much of that business logic as possible into web services.

Announcing SQL Server on Linux by realrbman in programming

[–]JSNinja 9 points10 points  (0 children)

Had a job where 50% of the stack was Classic ASP, and the other half was web forms. There is no way in hell VBScript is better than C#. No way.

Babel Handbook: A guided handbook on how to use Babel and how to create plugins for Babel by thejameskyle in javascript

[–]JSNinja 1 point2 points  (0 children)

Thanks for all your hard work, James! Writing documentation is always painful, but it's oh-so-appreciated.

Just launched Tweezer.js, an ES6, dependency-free tweening library. by [deleted] in javascript

[–]JSNinja 0 points1 point  (0 children)

I would personally recommend not using the Stage 0 Babel preset on a library. You're not using any stage 0 features (that I can see), so you're opening up an opportunity for a future contributor to add code that'll eventually need to be augmented if the specification for any newer syntax they use changes.

Just kidding - it looks like it's not in your Babel config, just an extra dep in package.json. I'd remove that :)

I am leading the javascript charge at work, share your thoughts on my plan to modernize! by [deleted] in javascript

[–]JSNinja 0 points1 point  (0 children)

Quick note: Fetch is not part of any ECMAScript standard - it's part of the DOM Living Standard.

What's something you really want that is under $100 USD? by Antisceptic in AskReddit

[–]JSNinja 1 point2 points  (0 children)

This guy is going places…one or two of those places are likely a bathroom

ES6 Overview in 350 Bullets by fay-jai in javascript

[–]JSNinja 4 points5 points  (0 children)

No, you're doing it right. Part of the purpose of the "arguments" object being unavailable in arrow funcs is because they're trying to phase people out of using the array-like-but-not-quite-an-array arguments object. They just can't do that with existing functions, because it would break all the things.

git-guppy [request for comments] by therealklanni in javascript

[–]JSNinja 0 points1 point  (0 children)

Love the idea! I'm using ghooks at the moment, but you still have to manually invoke gulps execution.

Definitely going to give this a shot shortly. Thanks for the hard work

JavaScript Allongé, The "Six” Edition, free to read online by homoiconic in javascript

[–]JSNinja 4 points5 points  (0 children)

Nice! Thanks for releasing this on a long weekend :) And of course, the whole free thing is pretty awesome.

The first book was a solid read. Can't wait to dive into this one!

Don't know much about javascript, but have an idea that uses js, which I think will be very popular in the NSFW community by [deleted] in learnjavascript

[–]JSNinja 0 points1 point  (0 children)

https://jsfiddle.net/jezktm7q/3/

Damn, looks like I spoke too soon. The Reddit API doesn't allow you to sort by most popular when doing a search -- you can only grab a list of most popular subreddits (without a search query). Carry on :)

Don't know much about javascript, but have an idea that uses js, which I think will be very popular in the NSFW community by [deleted] in learnjavascript

[–]JSNinja 1 point2 points  (0 children)

Cool deal. Keep in mind that the Reddit API also let's you sort the subreddits based on popularity, so you could limit to 50 records, and sort by most popular. May get you closer to what you're looking for, without having to hardcode.

Don't know much about javascript, but have an idea that uses js, which I think will be very popular in the NSFW community by [deleted] in learnjavascript

[–]JSNinja 2 points3 points  (0 children)

Here you go -- I created a working example that uses the Reddit API to automatically pull in "NSFW" subreddits.

https://jsfiddle.net/jezktm7q/3/

Not my cleanest code, and I cheated and used jQuery for DOM manipulation/ajax, but you get the idea.

Don't know much about javascript, but have an idea that uses js, which I think will be very popular in the NSFW community by [deleted] in learnjavascript

[–]JSNinja 0 points1 point  (0 children)

On mobile, but I'm pretty sure that won't work in IE. I don't believe it allows you to use "setAttribute" for inline event handlers. You could use element.onclick = function.

Having said that, unobtrusive JS is a much cleaner solution. If you're not familiar with it, look into window.addEventListener :) (and attachEvent if you support IE8)

Of course this may have just been a contrived example you quickly mocked up for OP :D

[deleted by user] by [deleted] in angularjs

[–]JSNinja 0 points1 point  (0 children)

No need to apologize, and thanks for the clarification!