Ten JavaScript Theory Questions

These are popular conceptual questions asked in JavaScript interviews.

There are countless questions your interviewers may ask when it comes to how JavaScript works. The idea behind asking these questions is to assess whether you have recent experience in writing JavaScript code.

Some more clueless interviewers tend to ask you for lexical knowledge and edge cases that you could simply look up online. I, personally, think that this signals a lack of competence from the end of my interviewers, and I tend to start getting concerned whether I am in the right place.

Usually, you are not allowed to use Google to find the answer, and you have to answer on the spot.

Question 1

Is JavaScript a “pass by value” or a “pass by reference” type of language when it comes to passing function arguments?

Answer: JavaScript passes function arguments by value. In case we pass an array or an object, the passed value is a reference. This means you can change the contents of the array or the object through that reference.

Read this article on value and reference types for more details.

Question 2

Study the following code snippet:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.