Values &Variables

Values

  • Number
    • Example Descripttion
      32 Integer
      .0001, 0.0001,1e-4, 1.0e-4 Floating-Point Numbers
      0377 Octal Integer
      0x34FA, 0X56ce hexadecimal integer
  • Logical (Boolean) Value: true, false
  • String : "This is a stirng", "The first line \n and \"second\" one"
  • null, a special keyword denoting a null value

Special Characters in a String

Character Meaning
\b  
backspace
\f  
form feed
\n  
new line
\r  
carriage return
\t  
tab
\\  
backslash character
\', \"

', "

Variables

  • Variable name
    • Case-Sensitive.
    • Start with a letter or underscore ("_").
    • Subsequent characters can be letters, underscores, or digits (0-9).
  • Variable Declaration
    • var x;
    • var x = 3;
    • x = 3;
  • Global vs. Local Variables
    • All variables declared outside functions are global;
    • Variables declared in a function are local, i.e., valid only in the function.