News for hackers. Stuff that matters.
Re:You Might Not Need Underscore by inglor on Friday July 03, 2015 @09:25AM (#9825419)
`Array.from({ length: n }, (v, k) => k + x)` this is a terrible way to create a range, it only works incidentally. Please do not use it.
Re:You Might Not Need Underscore by peferron on Friday July 03, 2015 @12:04PM (#9826309)
Which part of the spec makes you think it only works incidentally?

http://www.ecma-international.org/ecma-262/6.0/#sec-array.fr...

Re:You Might Not Need Underscore by inglor on Friday July 03, 2015 @02:04PM (#9827009)
The part where you're abusing an old "array like" and the way Array.from works with it and uses the index argument in the mapper argument to force it into a range. How many people do you think understand what `Array.from({length: 5})` works?
Re:You Might Not Need Underscore by peferron on Friday July 03, 2015 @10:46PM (#9828931)
Your comment sounded like it only worked because of implementation details in the JS engines. That would have been a much bigger deal than just not liking the style.

Out of curiosity, how would you do it yourself?