what is the this (inside inner functions) referring to in the following code context? Does it point to TimeSpan?
var TimeSpan = function (da
this
refers to the current object, in this case the function you are inside of. Since everything in JavaScript is an object you can modify the attributes of a function object using the this
keyword:
var f = function() {
this.key = "someValue";
}
console.log(f.key); // prints "someValue"
So in this case this
should point to the function at the deepest scope level, and not TimeSpan
.