In the following example we have an instruction that will print "Hello World" in the browser console.
The smallest individual unit in a program is called token.
Reserved keywords are words that carry a special meaning and must not be used to name variables and functions.
Identifiers are sequence of characters that are used to name the variables, functions etc.
Characters of an identifier can be a letter, digit, dollar sign and underscore. The first character cannot be a digit.
Following are valid identifiers.
Following are invalid identifiers.
List of literals.
The value of the Null literal is null. It represent null or empty.
The value of the Boolean literal are true and false. These are logical values.
We use Numeric literal to represent numbers or numerical value.
Following are the types of numerical values.
Decimal number are base 10 i.e., they consists of 10 digits 0 to 9.
Hexadecimal number are base 16 i.e., they consists of 10 digits 0 to 9 and 6 letters a to f. Upper case A to F is also used. Hex number start with 0x and 0X.
Example: 0xA is in hex form and its decimal equivalent is 10.
Click here for Hexadecimal to Decimal conversion tutorial.
Octal number are base 8 i.e., they consists of 8 digits 0 to 7. Octal number starts with 0.
Example: 017 is in octal form and its decimal equivalent is 15.
Click here for Octal to Decimal conversion tutorial.
In the following example we have a string enclosed in double quote.
In the following example we have a string enclosed in single quote.
Have fun learning :-)
Copyright © 2014 - 2019 DYclassroom. All rights reserved.
rendered in 0.0177 sec