Hacker News new | ask | show | jobs
by nawitus 4311 days ago
Well, testing 4 == '4' is pointless in my opinion, because you should never use the '=='-type equality in JavaScript. I never use it, so I don't even know what that evaluates to. You should always use ===, and set up a linter to enforce that.

What I think is valuable to understand is the concept of truthy and falsy, as I've seen even some experienced JavaScript programmers struggle with that. Maybe that could be a decent interview question.

1 comments

A response of "I'm not sure; I always rely on === and explicit conversions to avoid the ambiguity. My guess would be (doesn't matter) though" is not only answering that question, it's scoring an 11/10 of the possible points (were it pointed).