Something more from this & OBJECT PROTOTYPES by Kyle Simpson:
function addStuff(yin,yang){
return(this+yin+yang);
}
var firstStep = addStuff.bind(13,42);
var secondStep = firstStep(3.1415);
alert(secondStep);
Notice that we may assign some of the parameters downstream in a second step. That is the magic to take note of here in this practice. We will be given 58.1415 in this circumstance. Also note that the definition for this is always handed in first thing with .bind. I suppose we could have had a function signature with three variables and could have handed in null followed by two variables in the first step if as much seems confusing.
No comments:
Post a Comment