faqts : Computers : Programming : Languages : JavaScript : Language Core : Variables

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 11 people (55%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

When i have to declare a Variable with var and when not ?

Aug 24th, 2001 15:24
Juergen Thelen, Michael Lauermann,


Hi Michael,
Using "var" outside of functions is optional.
Using "var" inside of functions is a must for most situations, 
especially in recursive functions, or if global variables of the same 
names exist...
Hth, Juergen