Comment by nailer Comment by nailer 2 days ago 6 replies Copy Link View on Hacker News What do you mean? false isn’t true in JavaScript.
Copy Link Filligree 2 days ago Next Collapse Comment - “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. Reply View | 4 replies Copy Link nailer 2 days ago Parent Next Collapse Comment - Yes strings aren’t false unless they’re empty. Good thing. Reply View | 2 replies Copy Link macintux 2 days ago Root Parent Next Collapse Comment - Or, judging by other comments, “0”. Reply View | 0 replies Copy Link [removed] 2 days ago Root Parent Prev Collapse Comment - [deleted] Reply View | 0 replies Copy Link [removed] 2 days ago Parent Prev Collapse Comment - [deleted] Reply View | 0 replies
Copy Link nailer 2 days ago Parent Next Collapse Comment - Yes strings aren’t false unless they’re empty. Good thing. Reply View | 2 replies Copy Link macintux 2 days ago Root Parent Next Collapse Comment - Or, judging by other comments, “0”. Reply View | 0 replies Copy Link [removed] 2 days ago Root Parent Prev Collapse Comment - [deleted] Reply View | 0 replies
Copy Link macintux 2 days ago Root Parent Next Collapse Comment - Or, judging by other comments, “0”. Reply View | 0 replies
Copy Link astura 2 days ago Prev Collapse Comment - The string with the value of "false" evaluates to true.In other wordsIf ("false") { /* You will be here */ } Reply View | 0 replies
“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.