Javascript Variable Declare Assign A Value With Example
Declare Variables in JavaScript Before using a variable, you first need to declare it. You have to use the keyword var to declare a variable like this: var name; Assign a Value to the Variable You can assign a value to the variable either while declaring the variable or after declaring the variable. var name = “John”; OR var name; name = “John”; Naming Variables Though you can name the variables as you like, it is a good programming practice to give descriptive and meaningful names to the variables....