Hacker News new | ask | show | jobs
by scarmig 4311 days ago
Not at all off base.

Which is the reason I would be deeply annoyed by the 4 == '4' question. The technical answer is it evaluates to true, but the real answer is "any code that requires all readers to have intimate knowledge of Javascript type conversion rules to read and understand is horrific code."

1 comments

I'm with @lostcolony: if I were interviewing and a candidate said "don't do that, it's unpredictable, do this instead" it's a great answer.
At the same time though, as someone looking for their first dev job, I'm not going to tell the interviewer "don't do that." Given the people I've met in industry, I can't see that ending well- I would expect some variation of "who does this kid think he is!?"
True, but one time I was asked about the difference between "foo = bar" and "var foo = bar", and my answer was, "Don't do the first."
You can always phrase it as, "That's ill advised, here's why, my guess is it does X, but you probably shouldn't do that in production code".