Contradicting information on 0/1 or true/false or false/true


Hi Admins, In this lesson (2. While syntax) you are saying that Javascript understands 0 to be false and 1 to be true; this is the exact opposite of lesson 1 (1.While we're at it) where you use 0 to be true and 1 to be false; I don't think it is good to do this in a beginner course, it is very confusing and creates an extra problem to think of when learning and figuring out solutions whilst learning. I hope this can be remedied. Thank you and best wishes.

Replace this line with your code.


Well in the first example the 0 and 1 where compared to a 0. So in this case 0 meant 0 === 0 which is true and 1 === 0 which is false. In this case it is meant that you add nothing but the 0 or 1 in the while loop's condition and in this case pure 0 is false and anything other number is true (where true in particular has a numerical value of 1).


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.