Echo JS 0.11.0

<~>

kali 712 days ago. link 3 points
I've seen this article make the rounds in various other places. I don't mean to be rude or too hard on the author, but it's not a good article.

Mostly it's just the same handful of things that maybe 4000 other articles already commented on. There isn't anything new here at all.

The first question is quite absurd to ask as a quiz. All the explanation given is "super basic prototype chain stuff" and, of course, that helps nobody. Because there's nothing to understand about the code, there's nothing to reason about. You either know what .prototype and .__proto__ are or you don't.

The third one's explanation is... not an explanation at all. "It prints out 3 thrice since setTimout [sic] puts that log function to the next macro task queue". Yeah, so what? That's not the reason. The reason is that each log function created shares the same i variable. You can change the var to let and it would work differently. And yet it would still be true that setTimeout "puts that log function to the next macro task queue". So the explanation is wrong.

The fourth one is wrong too. You just have to copy the code and run it. It runs correctly. There's no SyntaxError at all there. If your console is nice enough it will give you a *warning* that there's some unreachable code. But it's only a warning. The code will run and it will log undefined.

The fifth one is just silly. I mean, ok... but that's a stupid quiz to ask your teammates.

The explanation on the last one is... well, I can't say it's wrong but it's really not helpful. All you should do is take the let a = b = 0; statement and explain how that works, which you don't do. You just say "b is a global variable" but you don't explain how or why or where does that come from. So for the only detail that could need an explanation, you don't explain it.

All in all, I don't think this is an article one should be sending around everywhere.
pitayan 711 days ago. link 1 point
Thank you for reading it and also the generous advice!
jaleksic 709 days ago. link 1 point
Might seem fun or stupid reading stiff like this in spare time.
But I actually turned down a job offer once because they made tests similar to these. I actually did quite well, but when I asked why the f**k we're doing this, and the guy said something like "well this stuff happens in real code all the time, and a good programmer should be able to spot it"... Well. I believe he even said an "intelligent" programmer should spot it.

With at least somewhat decent developers, stuff like this does _not_ happen.
And if it actually does happen in a company or team, then i surely wouldn't want to work there :) But I'm pretty sure such tests or quizzes do not reveal much about a developer's quality in real software life.