Pages

JavaScript Variables

JavaScript variables are "containers" for storing information:

Example

var x=5;
var y=6;
var z=x+y;






JavaScript Variables

As with algebra, JavaScript variables can be used to hold values (x=5) or expressions (z=x+y).
Variable can have short names (like x and y) or more descriptive names (age, sum, totalvolume).
  • Variable names must begin with a letter
  • Variable names can also begin with $ and _ (but we will not use it)
  • Variable names are case sensitive (y and Y are different variables)

No comments:

Flag Counter
| Copyright © 2013 Remote Tutor