3 ms·
It would be bad as the lone question. A candidate who whappens to not spot the "789a" will get it wrong, and you don't get any info about the quality of the ca
by adrianratnapala 9y ago
It would be bad as the lone question. A candidate who whappens to not spot the "789a" will get it wrong, and you don't get any info about the quality of the candidate.
But it is a good question if there are other fall-backs because you get lots of info in the case where the candidate gets it right. Spotting the "789a" shows an eye-for-detail (important!). The candidates' explantation of the consequence tells something you about how well they know the environment, and how well they can logically think about cause and effect.
- reificator 9y agoIf the correct answer was [123, 456, NaN...] then it would actually be a good question for the reasons you bring up. The thing that makes it a trick question is that map calls the given function with the value, the index, and the original array. And parseInt takes a value and a radix. Which means your 4th entry is parsed in base 4, your 8th is parsed in base 8, etc.... So the correct answer is [123, NaN, NaN...], and that makes it a trick question.