You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,3 +55,20 @@ var x = 10;
55
55
## Explanation
56
56
57
57
> Yes you can do this. this is called [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) it stands for immediately invoked function expression
58
+
59
+
## Use === instead of ==
60
+
61
+
```javascript
62
+
[10] ===10// is false
63
+
[10] ==10// is true
64
+
'10'==10// is true
65
+
'10'===10// is false
66
+
[] ==0// is true
67
+
[] ===0// is false
68
+
''==false// is true but true == "a" is false
69
+
''===false// is false
70
+
```
71
+
72
+
## Explanation
73
+
74
+
> The == (or !=) operator performs an automatic type conversion if needed. The === (or !==) operator will not perform any conversion. It compares the value and the type, which could be considered faster than ==.
0 commit comments