JavaScript If statement condition with no operator? What does it do?

前端 未结 4 1492
天命终不由人
天命终不由人 2021-01-01 17:10

I am used to if statements having a condition where ( x < y ) or ( x == y ). But in cases where there is no operator, what does the if statement check exactly? i.e. in th

4条回答
  •  醉酒成梦
    2021-01-01 17:44

    in some languages the predicate really has to return a boolean. In javascript this isn't the case.

    Some case like 0 or false (there might be others) are false, the rest is true

提交回复
热议问题