DEV Community

Discussion on: JS Test #1: Type conversion in JavaScript

Collapse
 
daaitch profile image
Philipp Renoth

Hey coderslang,

I'm not quite so happy the way you as "coderslang: become a SE" present those interview questions like they are "normal" to the JS world. They are not. Most of them are ugly JS edge-cases no one wants to have in their repository and should be removed in code reviews before they are checked in.

For a senior JS dev it might make sense to understand them, but at least it's enough to know that you should not write such code. Things like 0.1 + 0.1 + 0.1 !== 0.3 is fine to know, but e.g. for "adding arrays" like [1, 1] + [2, 2] you should agree that even if the result is what you want, you better not write it like that and confuse everybody. Why should you? Typescript will not let you do this because it's rubbish, so why is it worth to ask in an interview?

If you as a JS dev get such interview questions, leave immediately and apply for the next job :D, really. Either the company asking you such questions is supposed to have large legacy code bases, because most of the questions are about JS edge cases nobody wants to read or should ever write, but they have right in their projects, or they have no idea which kind of JS dev they want to hire.

Companies with modern experienced JS/TS teams will not ask you such questions or at least only a few just for fun.

Collapse
 
petermoyano profile image
Pedro Ignacio Moyano

Thanks for the comment, very usefull for us newbies. Where would you recomend checking out some relevant Javascript enterview questions?

Collapse
 
coderslang profile image
Coderslang: Become a Software Engineer

It looks like wouldn't be very happy if someone asked one of those questions during an interview :)