I create a function somewhere and I bind it to this
so that I can use the parent block's meaning of this
as the value of this
within the function. For example:
var foo = function() {
// some stuff involving other stuff
}.bind(this);
Is the this
I pass as an argument to bind
passed by reference, or by value? So if I change the parameters of the this
object a bit later in the outer block of code, and afterwards call foo
, will foo
use the value of this
at the time I called bind
, or at the time I called foo
?
this
is a reference to your object, so you're passing a reference of your object to the function, so if you change thethis
inside the function, then the original object get mutated as well. – Taamthis
is passed by reference, or value, the properties the object it points to will be the same because there's only one object. If you're really not asking what you asked, then you should change the question to what you are asking. – Pompomvar a = this;
does? – Pompom