var foo = 'Hello World';
a = b + c
These statements are parsed as
a = b+c(d*e)
But only well formatted statements are parsed. So for a good practice it's recommended to use semicolon as statement terminators.
//This is single line comment
var b =2;
var c = a+b;
Scope of b variable inside a function is limited to its body while variable a declared outside the function has a global scope and it also can be accessed in a function.
Any uninitialized variable will have undefined value.
var a; //undefined
Null is used to define a variable with empty value.
var a = null;
- + Used for adding two numbers or to concat two strings
- - Used for subtraction of two numbers.
- * Used for multiplication of two numbers
- / Used for divison of two numbers
- % Used for getting reminder of divison
- ++ Used to increment variable value by 1
- -- Used to decrement variable value by 1
- == Equal to .Used to compare two values
- === Used to compare two values and types
- != Not equal to.
- !== Not equal value and type.
- > Greater than
- >= Greater than or equal to
- < Less than
- <= Less than or equal to