• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Part III: Appendixes > Variables and Expressions

Variables and Expressions

A variable is a container that holds a piece of data (called the value). An expression is the part of a JavaScript statement that evaluates the variable, substituting the value for the variable where necessary. In JavaScript, we use the keyword var to create a variable, and the equal sign (=) to assign a value to a variable. Here is a typical group of statements using variables:

var x = 6; 
var y = 3; 
var z = x + y; 
x = x + 1; 
y = y + 1; 
var a = x + y; 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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