What's the difference between defining a variable with 'var' before, versus defining without it?
var s = 5;
s = 5;
This may not be the complete reason, but declaring with the var insures it is local to the proceedure, defining it without var may take on the instance of a variable at a higher level that has the same name.
Yep. With var, it's local, without var if undefined, it's global. I personally dislike declaring variables like that, I think it's bad practice.
Great wit and madness are near allied, and fine a line their bounds divide.
There are currently 1 users browsing this thread. (0 members and 1 guests)
View Tag Cloud