Defining variables differences
What's the difference between defining a variable with 'var' before, versus defining without it?
ex.
var s = 5;
Vs.
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.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks