In an earlier post about JavaScript idioms, I talked about a common idiom for copying an array:
var myArray = [];
for (var i = 0; i < source.length; i++) {
myArray[i] = source[i];
}
In a comment, Jesse offers the following alternative:
var args = Array.prototype.slice.apply(arguments);
To my eye, this is clearly preferable, and I hope more people use it in the future. Thanks for pointing it out, Jesse.
Also: here's a good list of JavaScript idioms.
Back to flipping out...