Reputation: 1195
Philosophically, why can't I declare a new variable in JS by using this sort of code:
var this.blah = "hello"
I see that it hangs upon 'this' being a variable that has a meaning already, but -exactly- how?
what about corner cases and constructor functions?
Upvotes: 0
Views: 62
Reputation: 24332
When you assign properties of an object, you never need the var
keyword. That is, you should never have something like var obj.prop = ...
.
Upvotes: 2