Basic Syntax and Flow Control

Variables

A variable is a named area in computer memory that is used to store information and from which information can be retrieved. As JavaScript is a relatively high-level language, it is not necessary to know most of the details of how information is stored in memory by a JavaScript interpreter. JavaScript provides for the automatic creation of variables whenever values are assigned to them. Here is a very short example showing how the assignment operator ( = ) is used to assign a value to a variable:
x = 3.4
A JavaScript interpreter will read this single line of code and do something like this:
  1. break the text into three parts called tokens; Tokens are the separate words, names, and symbols that have some meaning in JavaScript. In the statement above the tokens are:
x
=
3.4
  1. evaluate the right most token 3.4 as a number value;
  2. determine the center token is the assign.

0 comments:

Post a Comment

Flag Counter