Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
Hi, I am VCoder, Here I'll explain you wath's the heck : In JavaScript, boolean operators are a bit different from whose from other coding languages, In JavaScript, the OR operator will return the first truly value (true, not empty string, number other than 0, not empty array or object ) which are his operands, but if both of them are falsy values (empty string, array or object, 0 and false) the operator will return false And this the same principle with the AND operator If you want that it return a boolean value, you can do this : Boolean("John" || "user") ; I am making a serie of tutorials about a lot of things which are related with coding, so you can visit this page and say me what you want to learn : https://code.sololearn.com/WIb425hnGqfl/?ref=app If you "follow" me, I'll be able to give you everyday coding tricks Thank you and Good luck
29th Nov 2021, 11:14 PM
VCoder
VCoder - avatar
0
You're welcome !
29th Nov 2021, 11:18 PM
VCoder
VCoder - avatar