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

Chapter 2. Variables > Changing and Retrieving Variable Values

2.3. Changing and Retrieving Variable Values

After we create a variable, we can assign and reassign its value as often as we like, as shown in Example 2-1.

Example 2-1. Changing variable values

var firstName;                   // Declare the variable firstName
firstName = "Graham";            // Set the value of firstName
firstName = "Gillian";           // Change the value of firstName
firstName = "Jessica";           // Change firstName
						again
firstName = "James";             // Change firstName
						again
var x = 10;                      // Declare x and assign it a numeric value
x = "loading...please wait...";  // Assign x a text value


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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