1. There is no need to declare variable, however
you can
define variable with var keyword.
2. Curl braces ({}) are separated two code
blocks.
3. White space and carriage return are not count
in code statement.
4. Semicolon (;) terminate a statement.
5. For single line comment use double slash
(//).
6. For multi line comment use /* and */ sign.
Variable are place holder of value used in run time by the program, every
variable has an unique name within the scope of execution, while declaring the
variable always keep un mind.
1. Must start with number and underscore (_)
2. Use any alphanumeric character.
3. Do not use any special character and white space.
4. Variable name are case sensitive.
5. Do not use keyword as variable name.
Operator and order of precedence
1 | . | [] | () | ||||||||||
2 | ++ | -- | !~ | ||||||||||
3 | * | / | % | ||||||||||
4 | + | - | |||||||||||
5 | << | >> | >>> | ||||||||||
6 | < | > | <= | >= | |||||||||
7 | == | != | |||||||||||
8 | & | ||||||||||||
9 | ^ | ||||||||||||
10 | | | ||||||||||||
11 | && | ||||||||||||
12 | || | ||||||||||||
13 | ?: | ||||||||||||
14 | = | += | -+ | *= | /= | %= | <<= | >>= | >>>= | &= | ^= | != | |
Operators
+ | Concatenation |
Comparison Operators
== | Equal To | |
!= | Not Equal To | |
< | Less Than | |
> | Greater Than | |
>= | Greater than or equal to | |
<= | Less than or equal to |
Arithmetic Operators
* | Multiplication | |
/ | Division | |
+ | Addition | |
- | Subtraction |
Operators
&& | AND |
Operator
= | Assignment |
Keyword List
In
JavaScript there are 50 keywords, this are reserve word in the language you can
not use this keyword in naming of variable or function.
abstract | float | public | |
boolean | for | return | |
break | function | short | |
byte | goto | static | |
case | if | super | |
catch | implements | switch | |
char | import | synchronized | |
class | in | this | |
const | instanceof | throw | |
continue | int | throws | |
default | interface | transient | |
do | long | true | |
double | native | try | |
else | new | var | |
extends | null | void | |
false | package | while | |
final | private | with | |
finally | protected |
Construct
1. if.. else ..
2. switch case
Looping Construct
1. for
2. while
User Define Function
function <functionname>(argument)
{
//function body
return <value>
}