Pankaj Tanwar
Published on

Top 3 USELESS JavaScript interview questions 🤮

––– views

I recently went through the roller-coaster trip that every other corporate buddy goes through, THE JOB HUNTING. I've heavily worked with JavaScript so my interviews were around that.

JavaScript, also abbreviated as JS, is a popular programming language world wide.

If you take a look at the StackOverflow Developer Survey 2022, you will find that JavaScript tops the list of the most preferred programming language for the 7th consecutive year.

Some companies take pride in asking so-called interesting and useless pieces of JavaScript quirks to judge the candidate during an interview.

I'm going to list down the top 3 WORST Javascript real interview questions that that made me just walk out of the interview.

1. X !== X is True. Tell me how?

Like seriously? I can't imagine a job that requires this knowledge. And the irony is, the interviewer is expecting the exact same answer that he knows. I would be really skeptical about joining a company who cares about such things.

Well, the answer is NaN. NaN is never equal to anything, including itself.

This is nothing new. In fact, it is the specification. The IEEE 754 specification for floating point is that NaN should not be comparable. Once one also realizes that JavaScript stores all numbers as floating point, then these results are not a mystery. (Cf. https://en.wikipedia.org/wiki/NaN#Comparison_with_NaN)

I know, this is a good entertaining question. It requires you to have a really good understanding of some hidden JavaScript concepts.

But does this question really make sense? Will anyone ever use this in production code?

2. What is the fastest way to loop over a list?

I still can't get over the fact that it is one of the most repeated questions I've been asked. As simple it looks, as stupid it is. I don't understand the point of asking this question.

It's purely JS runtime dependent. Performance related questions in javascript interviews are quite popular.

Another similar question is What's the fastest way to convert String to Number in JavaScript? . My friend has explained very well in a stackoverflow answer that it depends on the browser (JS runtime).

3. Missing Context - Find problem in this code snippet question

The interviewer will throw a random piece of code and bluntly ask, what is wrong with this code snippet?

OK, I get it. You know something. But please don't put stupid tag on any candidate just because of this.

Instead ask, what is the most interesting tech challenge that you have solved. It would be entertaining and a good technical discussion for both.

I'll end my ramblings here but I'm sure some of you might agree with me on these points. If you have also faced similar interview questions, feel free to hit me up. I'm sitting behind pankajtanwar510@gmail.com