Skip to content

Instantly share code, notes, and snippets.

@andrit
Created July 13, 2018 18:35
Show Gist options
  • Save andrit/177f88b0e58e9a1aa19b9eaa89ffc73f to your computer and use it in GitHub Desktop.
Save andrit/177f88b0e58e9a1aa19b9eaa89ffc73f to your computer and use it in GitHub Desktop.

use apply to spread out arrays of values as parameters to a function call

function foo(a, b){
console.log( "a:" + a ", b:" + b );
}

foo.apply(null, [2, 3]);  //a:2, b:3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment