Skip to content

Instantly share code, notes, and snippets.

@predic8
Created November 19, 2013 18:38
Show Gist options
  • Save predic8/7550239 to your computer and use it in GitHub Desktop.
Save predic8/7550239 to your computer and use it in GitHub Desktop.
Takes a function with a parameter list and returns a function that takes an array contatning the parameters.
function splat(fn) {
return function(array) {
return fn.apply(null, array);
};
}
var power = splat(Math.pow);
console.log( power([2,8]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment