I am learning javascript . And I noted that the instructor was making variables in two ways . first was (for example):
var name ="Any string here";
and second method was simply writing the variable name without writing var first :
name="Any string here";
And the result was same . So , is there any difference between these two ?. Which one is better to use ?