Both the above two statements are same. In javascript, even if you don't declare a "var" keyword, it is automatically added.Note:-It is always good to use "var" to declare any variable in javascript. It makes the code cleaner and readable.Thanks and RegardsAkiii
Javascript
Topic: JS Variables
What is the difference between the below two statements:- (1) var myname = "Akiii"; (2) myname = "Akiii";
Browse random answers:
What is a JavaScript Variables?
How to create a JavaScript variable?
How to Re-Declaring JavaScript Variables?
What is the data type of variables of in JavaScript?
What is variable typing in javascript?
What is the difference between the below two statements:- (1) var myname = "Akiii"; (2) myname = "Akiii";
What’s the difference between these two statements:var x = 3;x = 3;