Why do we always have to use name in a JavaScript? For example var name="greg"
if (name=="greg") { alert ("hey greg"); }
In java,there is only data type called var which is used to store all the data types like string, integer etc.
Here name is the name of the variable. Variable name can be any valid name following some rules like there should be the space between words.
For more Details Refer following link: http://www.w3schools.com/js/js_variables.asp
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
In java,there is only data type called var which is used to store all the data types like string, integer etc.
Here name is the name of the variable. Variable name can be any valid name following some rules like there should be the space between words.
For more Details Refer following link:
http://www.w3schools.com/js/js_variables.asp