Hacker News new | ask | show | jobs
by kenbellows 2831 days ago
In that sort of case I like to use explicit type casting, e.g.

    if (Number(myNum) === 2) {}
For me this also extends to using `Boolean(val)` instead of `!!val`, etc.; though I understand the appeal of those nifty one-liners, I think they cause confusion in many places and don't communicate intent nearly as well.