Interviews

Javascript interview questions

Here is my list of Interview questions that I have been using at interviews to have a good conversation with candidates and...

Written by Luci · 3 min read >

Here is my list of Interview questions that I have been using at interviews to have a good conversation with candidates and find out about their understanding and vision of modern day Front End Development. This guide is more for people who are interviewing rather than being interviewed but I guess it can be useful for both sides of interviewing process.

“What , another set of interview questions?”

Yes. But I guess the difference that I am offering here is not in questions themselves but in the way that we look at the answers. I will try to elaborate on what we are looking for in each answer and what can be an indication of good understanding and attitude towards programming. In other words I will explain what we are looking for in the answers and how that will help us pick a good candidate.

React questions:

Q: What kinds of DOM do you know and what purpose do they serve?

A: This is a good way to see if applicant knows about basic principle of React which is Virtual DOM. Bonus points if they respond with Shadow DOM — this is a good follow up discussion to have too.

Q: Can you call a or change the property in a DOM element outside of react component?

A: The answer is no because that falls outside of the react philosophy which dictates that the components should react to changes in state instead of changing based on events. This is a good way to explore if the candidate understands the React philosophy and the difference between jQuery for example.

Q: Have you worked with create-react-app? What is it and what are the caveats?

A: This is just to see if candidate has experience with CRA and understands it. Bonus points if they mention the eject script. If they don’t we can ask them about eject and see if they understand the difference between ejected and non-ejected cra app.

Q: Which state management frameworks do you like to use and why?

A: This is to find out if they have experience and understand the modern state management frameworks. If they mention redux, ask them what are the main challenges with using redux, what they do and don’t like about it.

Javascript questions:

Q: What are your favourite JS array methods?

A: This question is to spark a conversation about javascript arrays. You can elaborate on the conversation by, for example, asking them to name some of the less popular array functions like reducekeys etc or what’s the difference between forEach and map.

Q: What is the difference between == and === in an if statement?

A: This is a very simple question to answer but depending on the way that it’s answered you can pick if they have a deep understanding of the subject or not. For example if the answer sounds like “well more accurate to do triple equals” then they perhaps don’t really know why you need triple equals in most cases if you also want the type of the variable to match.

Q: What’s a Promise?

A: This question is the one that candidates have the most trouble with. But usually it’s not because they don’t know what it is but because it’s a bit hard to explain. Promise is a delayed action, it returns an object that is set to return a value, fail or get cancelled. Promise is the preferred way to perform async actions in JS today.

Q: Provide 2 examples of functions both modifying a property inside of the object in array of objects where one is mutable and another one is immutable.

A: This is a good way to see if applicant understands the difference between mutable and immutable approaches. What you are looking for is a good use of array functions like forEach which loops through same array (mutable) and map that returns a copy of array instead of modifying it and not changing the original one (immutable).

Typescript questions:

Q: What is typescript and how is it differ from Javascript?

A: This is a pretty big topic but it can be boiled down to “Typescript is a strongly typed language add-on to javascript that allows compile time errors.” The emphasis here should be on “strongly typed”. Also compile time errors is a good topic, for example you could ask “what’s the advantage of having compile time errors?”

Q: What is a Type?

A: Type is a predefined Shape of an object that you are going to use in your application to make sure that you use it in the right way. This question is pretty easy to answer but try to get them to the second part — why use types at all?

Q: What’s the difference between a Type and an Interface?

A: Interfaces are more flexible, they are more like Classes they can extend other Interfaces and Classes.

Q: Is Typescript “object oriented programming”?

A: Technically there is no correct answer to this question since OOP is a “style“ of writing code, if you want you can write plain Javascript in some sort of OOP. But it’s a good conversation starter about OOP and Functional, Declarative and Imperative styles of coding.

When interviewing I try not to ask many questions but try to talk deeper about fewer questions. Ask to elaborate on things that they mention in their answers as that is what is often what they are comfortable to talk about and you want them to be comfortable as, ultimately you want them succeed.

I hope this article will help in your interviewing for new colleagues.

Written by Luci
I am a multidisciplinary designer and developer with a main focus on Digital Design and Branding, located in Cluj Napoca, Romania. Profile

12 useful JavaScript interview tips

Luci in Interviews
  ·   9 min read
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x