JavaScript Bind()

Fun Fun Function video on bind examples

functions are values that can be passed around, but they don’t ‘bring’ their context

‘this’ refers to the context of the calling function

‘bind()’ creates a copy of a function, changing ‘this’ to refer to the bound object:

var bindingVar = boundFunction.bind(objBoundTo);
bindingVar() //this refers to objBoundTo

Leave a Reply

Your email address will not be published. Required fields are marked *