What is the difference between the below two statements:-
(1) var myname = "Akiii";
(2) myname = "Akiii";

 Posted by Akiii on 12/17/2011 | Category: JavaScript Interview questions | Views: 5101 | Points: 40

Both the above two statements are same. In javascript, even if you don't declare a "var" keyword, it is automatically added.

It is always good to use "var" to declare any variable in javascript. It makes the code cleaner and readable.

Thanks and Regards

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response