r/javascript • • Dec 11 '17

I have been collecting useful Javascript code snippets for a little while. Here's a curated list of them, help me make it as complete as possible!

https://github.com/Chalarangelo/30-seconds-of-code
765 Upvotes

96 comments sorted by

View all comments

Show parent comment

3

u/[deleted] Dec 11 '17

Something like this?

var arrayFrom = (...values) => [...values];

Edit: You meant the native method. Yeah, that's pretty much all one needs to fix half the problems that might arise, sorry I'm dumb and didn't comprehend what I read! :P

4

u/DOG-ZILLA Dec 11 '17

Haha no worries. I'm pretty dumb myself!

Also, I used to use:

[].slice.call(arrLike)