this
points to the instance of the object. So if you were to do this:
var potato = new List();
potato would have (pretty much) properties assigned to it, called start
and end
. You would access them like this:
potato.start /* equals null, because the
function constructor set it to null
using the this keyword,
this.start = null;
*/
You can try it yourself. Start your console (Ctrl+shift+j) and type in this:
function Foo(){
this.length = 'bar';
this.stuff = 'buzz';
}
Now try assigning it to a variable:
var foo = new Foo;
and accessing those properties.
foo.length
// returns 'bar'
foo.stuff
//returns 'buzz'
If you changed these:
foo.length = 'I have no length';
It would only apply to that instance, so if you were to do:
var foo2 = new Foo();
foo2.length
//still returns 'bar'
foo.length
// still 'I have no length'