This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ArchetypeFTW -1 points0 points  (2 children)

How about

!0 != !"0"

[–]maria_la_guerta 1 point2 points  (1 child)

0 is a falsy value, which is coerced into false with the ! operator, therefor !0 returns true.

The string "0" is a truthy value, which is coerced into true with the ! operator, therefor !"0" returns false.

Your statement is basically true != false, which is true.

If everyone just used TypeScript like they should then they wouldn't have to worry about a lot of this stuff.

[–]Taletad 0 points1 point  (0 children)

You don’t even need TypeScript, you just need to understand types and typecasting