Explain this || | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Explain this ||

Explain the output: console.log(null || 5 || {} || "string");

30th Oct 2019, 8:45 AM
Ajit Kumar
Ajit Kumar - avatar
4 Answers
+ 8
When you use || operator, it outputs the first non falsy value, here is 5.
30th Oct 2019, 9:19 AM
Qasem
+ 7
Noise Of Silence I would say that Qasem is already at a platinum level. So we could say that he already has a gold and platinum medal.
30th Oct 2019, 10:55 AM
Sonic
Sonic - avatar
+ 6
It's called logical or.
30th Oct 2019, 10:54 AM
Sonic
Sonic - avatar
+ 2
Someone give this man a medal 🏅 Qasem this guy is just amazing !
30th Oct 2019, 10:11 AM
Ajit Kumar
Ajit Kumar - avatar