Sunday, April 29, 2012

Variable with and without 'var' keyword into JavaScript

When we  declaring the JavaScript variable actually we are creating the property of JavaScript global object. We can define the variable into JavaScript with  and without 'var' keyword, What is the main difference on it?.
When we used the 'var' keyword for define the variable then it is not configurable which means it can not be deleted by delete operator whereas in case of not using the 'var' into variable then the variable would be configurable which means it can be deleted by delete operator.

Please take care of it and always try to define a variable with 'var' keyword.