true or false = true? | SoloLearn: Learn to code for FREE!


true or false = true?

QUESTION var x = false || true; document.write(! (x !== true)); why false || true equal to true? Hope you can solve this for me! Thanks a lot!

11/20/2018 4:51:31 PM

Rex Hung

4 Answers

New Answer


true and false is a boolean. For example : console.log(2 == 3) : false because the 2 numbers is different. console.log(2 == 2) : true because the 2 numbers is the same.


The || operator means ‘or’, so a || b is ‘a or b’ and is true if either a is true or b is true. With false || true, the right hand side is clearly true, so the or statement evaluates as true.


Logical "OR" ( || ) operator return true if one ore more of the expressions to be evaluated is true. You can read more about logical operators here: