Java script variable question
What is the difference between a variable in java script declared with "var" keyword and without using var keyword in .net .aspx page??
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ranjit PowarPosted Feb 7, 2016, 3:13 AM
Vivek KumarPosted Feb 7, 2016, 1:53 AM
Amit Kumar SinghPosted Feb 6, 2016, 12:33 PM
In JavaScript:
In your first example, 'a' is being instantiated and set within the function scope. In your second example, 'a' is being set outside the function scope (most likely window.a).
With
var:Without
var:Abhay ShankerPosted Feb 6, 2016, 12:27 PM
Chandan Kumar SahooPosted Feb 6, 2016, 11:56 AM
Rajeesh MenothPosted Feb 6, 2016, 11:34 AM
.Net also using var keyword.
More details refer the following article :
http://www.c-sharpcorner.com/UploadFile/5ef30d/var-keyword-in-C-Sharp-programming/
Krishna Rajput SinghPosted Feb 6, 2016, 11:32 AM