Array Function push, pop, shift, unshift
myarr = [1,2,3,4];return = myarr.pop(); // [1,2,3] return 4
return = myarr.shift(); // [2,3] return 1
return = myarr.unshift(6); // [6,2,3] return 6
return = myarr.push(5); // [6,2,3,5] return 5
------------------------------------------------------------------------
Global vs local scope variable and functional variable
- Variable declared inside function with var is local.
- Variable declared inside function without var is global.- Variable declared outside function is global.
var a =5; // global variable
function() {
var b = 6; // local functional variable
c = 7; // global variable
}
console.log(a); //5
console.log(b); // undefined
console.log(c); // 7
---------------------------------------------------------
Escaping special character
\\ backslash \
\n new line
\r return -enter key like
\" " as string
\' ' as string
\t tab
\b back space
\f form feed
---------------------------------------------------------
Comparision Operator
2 == 2 // true
2 == '2' // true
1 == true // true
Strict Comparision Operator
- also compare data type2 === 2 // true
2 === "2" // false
1 === true // false
Comprision with Inequlity Operator
2 != 2 // false
2 != "2" // false
1 != true // false
Comprision with Strict Inequlity Operator
2 !== 2 // true
2 !== "2" // false
1 !== true // true