Skip to content

Instantly share code, notes, and snippets.

@geraldyeo
Created February 10, 2011 05:50
Show Gist options
  • Save geraldyeo/820012 to your computer and use it in GitHub Desktop.
Save geraldyeo/820012 to your computer and use it in GitHub Desktop.
super-fast operations
var max:Number = Math.max.apply(null, randomList);
/*
An array's push method is capable of taking any number of arguments (meaning statements like this are valid: array.push(1,2,3,4)). Thus, if we call that method using apply and put in the sliced array all of the resulting items will be "concatenated" onto the end of the array, in one, single super-fast operation.
*/
array.push.apply( array, array2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment