Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What do you mean? false isn’t true in JavaScript.


“false”, not false. So there’s odd type coercion, but the problem is that it can happen without you asking for it.

Python does the same thing. I don’t like it there either, but at least it’s more consistent about it.


Yes strings aren’t false unless they’re empty. Good thing.


Or, judging by other comments, “0”.


The string with the value of "false" evaluates to true.

In other words

If ("false") { /* You will be here */ }




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: