by rhapsodic · 8y ago · 0 comments
Based on my experience interviewing candidates with years of alleged "experience", I marvel at how many so-called professionals don't bother to learn Javascript in any depth. I've had more than a few candidates that couldn't demonstrate how to iterate through the elements of an array, for example. Or correctly give the truth value of expressions like:
" ";
"";
undefined === null;
and on and on. These, to me, are dealbreakers. If someone can't rattle them off, I'm not going to pay them the six-figure salary they claim they're worth.I'm surprised at the amount of resentment this sentiment of mine generates here on HN, of all places, but it does.
Of course you could memorize all those rules and then use them in your in your codebase to save a few keystrokes - requiring all other developers to also memorize them of course. Alternatively, you could just avoid the mess altogether and use explicit conversions, which is also what JavaScript linters recommend. But then you will easily forget the rules since you never use them.
Therefore the questions say a lot about what forms of knowledge the workplace prioritize, so it is a valuable signal to the applicant. Knowing that the interviewer requires applicants to be able to rattle off these rules say a lot about what kind of colleagues you will get and how the company approach code.
Yes. And a lot of self-described Javascript developers don't even know that. Because they've never read a book or any other document that explains those rules. And that's why they struggle, like the person in this thread to whom I originally replied, and they can't produce correct code quickly and efficiently, and they create bugs that they don't understand and can't fix, and they can't correctly understand code written by someone who actually understands those aspects of the language.
I agree that you can't memorize everything there is to know about Javascript. But if you don't know something, you have to at least know that you don't know it, so you can look up the correct information when you need it. But a lot of self-described Javascript developers don't even know what they don't know.
For example, I know that the methods String.prototype.substr and String.prototype.substring both exist and they're both used to extract substrings from a string. But I still, for some reason, unless I've used one or the other within the last day or so, I have to check the API docs to determine which one I want to use and what its parameters are. I know that I don't know what I need to know. What I will never do, is write a loop that extracts the characters I need one at a time and builds the substring from them. But I have seen where people have done that, in production code and in technical interviews. I am of the opinion (not universally shared here on HN, apparently) that that is not acceptable from a highly paid professional software developer.
And certain basic things about JS, like the ones I originally described, I think you should just know. But again, that's just me.
It's like the flip-side of foobar, avoid like the plague any place where all the tech questions are gotchas or obscure language features. The lead developer is probably someone you do not want to work with.
Serious question: what the hell are you talking about?
>It's like the flip-side of foobar...
WTF does that even mean?
>avoid like the plague any place where all the tech questions are gotchas or obscure language features. The lead developer is probably someone you do not want to work with.
If you consider those questions "gotchas" or "obscure language features" you don't stand a chance of working with those lead developers. Their process is designed to weed people like you out.
I think, for the book I'm writing, I can build an entire chapter around this subthread. Can I quote you by name, mattmanser?
var a = [];
a[0] = (a[0]+"")[1];
a[1] = (a[1]+"")[2];
`${a[0]}${(!"" + "")[3]}${(!"" + "")[1]}${a[1]}`;
Anyone who couldn't easily read it deserves to be fired on the spot. !!( " ")
!!("")
!!(undefined === null)
You probably want to test for any falsey value though. So the interviewee understanding the ToBoolean spec [0] would be what you actually want to be testing for. if (!x) {
// interviewee should be able to answer for which values of `x` this condition would run
// this shows they understand which values are falsey and which values are truthy
}
The knowledge being tested would be "the same" but in a different, and I feel more direct, way. I felt your test was testing their knowledge of implicit conversion and not truthy/falsey values, so I wrote purposefully confusing code that uses implicit conversion."If everyone can easily understand what's going on, there's no harm writing code like that!" /s
[0] http://www.ecma-international.org/ecma-262/6.0/index.html#se...
`${Array(5).join("pi" * 3.14)}, ${atob("QmF0bWFu")}`What absurdity.
What absurdity.
By "dealbreaker", do you mean that you will not take a job that requires you to write Javascript at a professional level? If so, kudos for walking your talk.
That may well be the best approach in some circumstances. But do you think I'm being unreasonable wanting to hire only someone who knows those very fundamental aspects of the Javascript language?
I don't see those examples as esoteric at all. Ignorance of those basic things can result in all sorts of bugs. If I'm paying someone a six-figure salary, I want them to know those things. But that's just me.
For example, if a candidate responded to a question like those you ask with "My hunch is that they would evaluate to $answer, but I'm not 100% sure of that: I can never remember the whole JS boolean-equivalence table, so I'd look that up to be sure. May I do so now? Also, if faced with that situation at work, I would, within reason and with testing, try to remove code that relies on rules like that--which I recognize are common, but still consider a very high-risk bug surface--in the area in which I was making changes", would you consider that an unqualified candidate? Or someone with perspective?
undefined == null;
Does that mean I am hired? :-)
Not necessarily, but it puts you ahead of about 80% of all the other candidates in consideration.