January 2018
Intermediate to advanced
678 pages
20h 16m
English
Let’s continue working our way through the code in the Hello web page’s function. Here’s the function’s first statement:
var msg;
The msg thing is a variable. You should already be familiar with variables in algebra. You can think of a variable as a box that holds a value. In this case, the msg variable will hold a string that forms a message.
Before you use a variable in JavaScript code, you should use var to declare the variable in a declaration statement. For example:
var name; var careerGoals;
Words that are part of the JavaScript language are known as keywords. The word var is a keyword. On the other hand, name and careerGoals are not keywords because they are specific to a particular web page’s code and not to the JavaScript ...
Read now
Unlock full access