-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostandpreinc.js
More file actions
76 lines (51 loc) · 1.5 KB
/
postandpreinc.js
File metadata and controls
76 lines (51 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//Arithmetic
//+ - * / % ++ --
//Play around with post and pre increment/decrement operators
//String
//Comparision
// == === != !== > < >= <=
//== V/S ===
//== Operator Usage
1 == 1 // true
'1' == 1 // true
1 == '1' // true
0 == false // true
0 == null // false
var object1 = {'key': 'value'}, object2 = {'key': 'value'};
object1 == object2 //false
0 == undefined // false
null == undefined // true
//=== Operator Usage
3 === 3 // true
3 === '3' // false
0 === false //false
1 === true //false
null === undefined //false
var object1 = {'key': 'value'}, object2 = {'key': 'value'};
object1 === object2 //false
// http://adripofjavascript.com/blog/drips/object-equality-in-javascript.html
//Logical Operators
//&& || !
//BITWISE
// & | ^ ~ << >>
//typeof
typeof Object;
typeof new Object();
//Ternary ? :
//delete
//in
"c" in {a:1, "b":2, "c":3}
//It checks only object property names
// The in operator, when used together with arrays, will check if an index exists.
// Note, it is ignorant of actual value (in either arrays or objects.)
"c" in ["a","b","c"]; //false
0 in ["a","b","c"]; //true
// You can check for properties on built-in data types. The length property is native
// to all arrays:
"length" in [];
"length" in [1,2,3,4];
// The ”length” property does not exist natively on an object unless it’s added explicitly:
"length" in {}; //false
"length" in {"length" : 1}; //true
"constructor" in Object;
"prototype" in Object;