I read that this is a valid JS statement: if(var == 4) All along i thought that if you use "var", you got to tag to something like this var final = 4 , so if (var final ==4) should be correct? is there anyone to explain? thks Beginner. askscript
Well... I haven't ever thought about that before, and I don't know why you would use it. Maybe some browsers will parse it incorrect? Where are you reading that? Don't you think they just mean that "var" is the name of your variable?
var is a reserved word in javascript, like 'if', 'then', 'else', 'switch', 'case', etc. and it's a bad idea to use it as a custom variable name, even if it works.