Skip to content

Commit 06cd655

Browse files
authored
Update 100_JS_Que
1 parent 54a979d commit 06cd655

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

100Questions/100_JS_Que

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,50 @@ const name = "priya"
8383
console.log(name()); //Error: name is not a function
8484
//Explaination : Function we are calling but it's not present so it will an error.
8585
--------------------------------------------
86+
const result = false || {} || 20 || null;
87+
console.log(result); //20
88+
//Explaination : OR operator will find first positive value. Null is a falsy value by default. {} is a positive value. It didn't reach till 20 and null.
89+
--------------------------------------------
90+
const result = null || false || '';
91+
console.log(result); //''
92+
//Explaination : OR operator will find first positive value. It will print '' because any of the true value didn't found so it will pick last value always.
93+
-------------------------------------------
94+
const result = [] || 0 || true;
95+
console.log(result); //[]
96+
//Explaination : OR operator will find first positive value. It will print [] because empty array/object is a positive.
97+
-------------------------------------------------
98+
console.log(Promise.resolve(5)); //Promise {<fulfilled>: 5}
99+
//Explaination : While doing resolve(), itself here a promise. If we pass number/string etc then it will print fulfilled.
100+
------------------------------------------------
101+
console.log("smile" === "smile"); //true
102+
//Explaination : Each emojy contain unicode where we are compairing unicode not the emojy so it's true
103+
-------------------------------------------------
104+
JSON.parse ?
105+
Parse JSON object to a JavaScript value // converting data into js object
106+
-------------------------------------------------
107+
108+
109+
110+
111+
112+
113+
114+
115+
116+
117+
118+
119+
120+
121+
122+
123+
124+
125+
126+
127+
128+
129+
130+
131+
86132

0 commit comments

Comments
 (0)