OK now its time get familiar with variable, what is variable actually ? The answer is” variable is sort of a data container”. We can store data on a variable and reuse or manipulate them to achieve targeted output. Other way you can say it as an identifier of data.
We also didn’t assign any value to tom, it will remain undefined until value assigning . Without assigning a value, A variable also give output undefined. You can assign a value like var tom; tom = 20; Here we declare a variable then assign it’s value to 20.
We can also write this code directly as var tom = 20; . To declare multiple variable in a single statement just use a comma to separate them like var tom = 20, jerry = 50; . To declare a string variable we have to use a single quote or double quote. As an example var spiderman = “ Spiderman is a super hero ”; or var spiderman = ‘ Spiderman is a super hero ’; both format is right. That’s all for today. Happy coding!