JavaScript Statements: Values

JavaScript Statements are composed of:

  1. Values
  2. Operators
  3. Expressions
  4. Keywords
  5. Comments

The JavaScript syntax defines two types of JavaScript values: Fixed values and Variable values. Fixed values are called literals. Variable values are called variables.

With literals, the most important rules for writing fixed values are:

With variables, in a programming language, variables are used to store data values. JavaScript uses the var keyword to define variables. An equal sign is used to assign values to variables. For example, if x is defined as a variable, and x is assigned (given) the value 6, then the variable will be 6. The script may look like this:
     <script>
         var x;
         x = 6;
         document.getElementById("demo").innerHTML = x;
     </script>

Back Table of Contents Next