How comes this works:
function Test() {
this.t=function() {
var self=this;
self.tutu = 15;
console.log(self);
}
}
var olivier = new Test();
This works:
function Test() {
this.t=function() {
var self = this,
other = -1;
self.tutu = 15;
console.log(self);
}
}
var olivier = new Test();
And this doesn't work (with the error SyntaxError: Unexpected token .):
function Test() {
this.t=function() {
var self = this,
other = -1,
self.tutu = 15;
console.log(self);
}
}
var olivier = new Test();