Javascript: is using 'var' to declare variables optional?

Posted by codemeit on Stack Overflow See other posts from Stack Overflow or by codemeit
Published on 2010-03-21T01:06:51Z Indexed on 2010/03/21 1:21 UTC
Read the original article Hit count: 292

Filed under:

Is "var" optional?

myObj = 1;

same as ?

var myObj = 1;

I found they both work from my test, I assume var is optional?

© Stack Overflow or respective owner

Related posts about JavaScript