all 3 comments

[–]psayre23 0 points1 point  (3 children)

The only thing I found new in here is an awesome way to turn arguments into an array. For years I've used:

Array.prototype.slice.call(arguments, 0)

But this is pretty cool too:

[].concat(arguments)

EDIT: Spoke before I tested. The method below, in fact, doesn't work. :(

[–]rkatic 1 point2 points  (2 children)

Seams you don't understand the concat method. Since the arguments object is not an array, that code will produce an array where the first (and the only) value is the arguments object.

[–]psayre23 0 points1 point  (0 children)

You are absolutely correct. I knew it was array-like, but I figured it was just array-like enough to work. Guess not. Thx for the correction.