undefined == false / output is false | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

undefined == false / output is false

in JavaScript {} // output is undefined undefined == false // output is false undefined === false //output is false Why false came ?? Do u know how? Any js experts here to solve this..?

10th Nov 2019, 8:05 AM
subramaniam.k
subramaniam.k - avatar
1 Answer
+ 4
no type coercion for undefined, so explicitly convert its type. console.log(typeof undefined ); console.log(Boolean( undefined )); console.log(Boolean( undefined ) === false); https://code.sololearn.com/Wjf7hldPVio6/?ref=app
10th Nov 2019, 8:26 AM
Gordon
Gordon - avatar