Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  15] [ 7]  / answers: 1 / hits: 25572  / 13 Years ago, tue, august 16, 2011, 12:00:00

Possible Duplicate:

Difference between using var and not using var in JavaScript

Should I use window.variable or var?






I have seen two ways to declare a class in javascript.



like



window.ABC = ....


or



var ABC = ....


Is there any difference in terms of using the class/ variable?


More From » javascript

 Answers
29

window.ABC scopes the ABC variable to window scope (effectively global.)



var ABC scopes the ABC variable to whatever function the ABC variable resides in.


[#90583] Monday, August 15, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
willieelisham

Total Points: 201
Total Questions: 108
Total Answers: 106

Location: Zambia
Member since Sat, Oct 31, 2020
4 Years ago
;