Instantly share code, notes, and snippets.

Embed
What would you like to do?
js bind method
var sum = function(x,y,z){
return x+y+z;
};
//bind()の第一引数は新たに作られる関数thisの値。今回はnull.
var newFunc = sum.bind(null,2,3);
console.log(newFunc(1)); //=>6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment