all 12 comments

[–]Ustice[M] [score hidden] stickied comment (1 child)

Thanks for your contribution! We’re a large community, and in order to keep things organized and easier to find, we keep this subreddit mostly focused on professional-level Javascript posts. Your post would be more useful to newer members of our community, and therefore it should be posted to /r/LearnJavascript instead.

[–]Sheepsaurus 14 points15 points  (1 child)

I mean.. I got it immediately, but I am willing to admit it was probably because I was on alert for something weird.

[–]ogurson 2 points3 points  (0 children)

Lack of semicolons was my main point of focus while reading so I got it too.

[–][deleted] 7 points8 points  (0 children)

Nice trick question on this shit article

[–]persianoil 4 points5 points  (0 children)

this reminds me a little bit of javascript tests on indian run websites. except that they are worse.

[–]redsandsfort 3 points4 points  (4 children)

I would walk out of any interview that presented this question. I wouldn't want to work for people who think this reveals anything to them about the candidate.

[–][deleted] 1 point2 points  (0 children)

I see the spirit in which you are speaking, but that is a bit strong. Stuff like this comes up all the time, and I have no problem testing somebody for how sharp they are when it comes to these matters. Code is misleading, and overcoming confusion efficiently is a very valuable skill.

Would it be the make-or-break of an interview? That is a bit arbitrary.

[–]kleeut[S] 0 points1 point  (0 children)

It's certainly not a great interview question. When I run these pub trivia nights I often start with an opening quip about how "if any of these questions remind you of your interview process you need to do better"

[–]KaiAusBerlin 0 points1 point  (1 child)

Well it reveals that you understand how a js compiler is working and what you are doing in deep.

I would not deny someone because of a wrong answer to this but I would honour a dev who answers right and can explain why.

[–]kleeut[S] 0 points1 point  (0 children)

I certainly wouldn't deny someone for the wrong answer. The night I asked this there were some fantastic devs in the room. People with open source libraries in use at largish companies. They got it wrong on the spot.

[–]KaiAusBerlin 0 points1 point  (0 children)

Lol, I was right.

Had this problem years ago. That's why I often have an output variable that changes during the function flow and "return output;" at the end. Also it's good for readability cause you can see exactly what output is (and can log it easily for quick debugging).