• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Variables

When you store data in a variable, you’re setting aside space for it in your program and giving it a name that you can refer to it with in your code. Unlike literals, you can manipulate and change the value stored in a variable, such as the current temperature, the value in a bank account, the current amount the user owes, and so on.

In JavaScript, you should first declare a variable before you use it, and you use the var statement to do that. This statement has been around since the beginning, as you see in Table 2.1.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint