DEV Community

Junaid
Junaid

Posted on • Updated on

Interview questions for JS

Javascript Interview Questions

Javascipt is a great language and i believe every web developer in todays world should definitely learn it.

Not is it just awesome but also by just learning and understanding javascript you will be able to learn and use so many great frameworks that are buzzing in current job market
like React , Angular , Next JS etc.

So this is a gist of some of the questions and concepts that i have came across in my interview for some product based startups.

Basics

Basics of javascript should be clear very much , Things like arrays , objects , variables etc should be very clear before even you think of applying at any job as a js dev.

Arrays

Arrays are very important and since you will be using them so much in your day to day use case as being a web dev you should definitely learn all the things that can be done in js for arrays like
* Push
* pop
* shift
* unshift
also you should learn how we iterate over arrays

Also learn these :-
* Slice
* Splice

Objects

Every developer in his day to day life will definitely come across objects while working on a javascript project .
So every interviewer expects you know the basics of Objects.

Try to understand them and apply them in any of your projects.

Objects will also be used while you work on things like json all that is is a big blob of object so you have to work with them .

So try to understand all related topics to objects
Things like how we add an item to an object

  • How to iterate through an object
  • How can we delete an item from an object

Try to also learn things like object.keys , object.freeze etc.

More Good Topics

Every interviewer will ask you questions related to these questions so its very necessary that you know these concepts and can explain them in detail

  1. Whats Execution context in js.
  2. Whats a promise and how to create one .
  3. What are callbacks
  4. whats async/await used for
  5. Difference between == and ===
  6. whats call , apply and bind .
  7. Difference between simple functions and arrow functions
  8. Whats 'this' in javascript
  9. What are closures
  10. whats memoization
  11. what is an IIFE(Immediately Invoked Function Expression).
  12. Difference between let and Var.
  13. Different stages of a promise.
  14. Difference between setTimeout and setInterval

There are other topics also which you should give a good go before going for the interview , not everyone will ask you these but its good to know them

  1. Whats prototype and prototypal inheritance
  2. what are anonymous functions
  3. Event bubbling and how do you prevent that.
  4. Whats promise.all
  5. whats a polyfill.

There are many many topics in javascript that you would to know but for a fresher js or even for 1+ year of experience these are the most asked questions .
You can also checkout the greats series by Akshay Saini which explains all the javascript concepts in great detail.

All right , i guess this will be hopefully helpful for any one out there .

Feel free to reach out to me for any thing over email
junaid shah

Top comments (20)

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
oniichan profile image
yoquiale

I call BS. I forget these most of the time because I don't use them even though I learn the concepts over and over.

Thread Thread
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
soulfiremage profile image
Richard Griffiths

I'd worry about an interviewer who focussed on this kind of thing rather than having a proper conversation about projects past and present, issues they've got and my opinions (in general) around them. I'd want them to find out if I would fit and likely learn what they and their clients need rather than whether I'm the current version of a Javascript language reference.

They should use my project experience to determine whether or not I'm used to using different tools to solve business relevant problems and whether I'd sit and pickle or actually go out and figure out exactly how to solve some awkward requirement.

If they're focussed on whether I know syntactic detail of a specific language, then they are a very junior interviewer and don't actually understand what their team needs.

If your questions are the kind that a few hours of google can answer, then you are thinking, conceptually, at the wrong end of the scale to get anything worthwhile done.

Unless you really really do want someone who just swallowed a javascript book?

Collapse
 
__junaidshah profile image
Junaid

Thanks for your valuable comment , richard .
While i totally agree with you but i have been asked these kind of questions many a times while i sat for an entry level dev position .

Collapse
 
soulfiremage profile image
Richard Griffiths

Ah I remember my first entry level too. I guess, being fair, context is everything.

Still, I'd hope a beginner would try to have projects already they can chat about as I'd still be biased against pop quizzes and strongly focussed on whether they would work with us, albeit as a newbie.

Thread Thread
 
__junaidshah profile image
Junaid

Absolutely having some good projects takes you a long way .
I remember mine first as well and since i had some projects built i was able to take the interviewer about how i went about creating them and in one of the projects we even discussed what could have improved if i would to optimise it right now ,
So i guess yeah having some projects is quite nice to have , it. shows that you really can do some work on your own and can learn

 
Sloan, the sloth mascot
Comment deleted
Collapse
 
urielbitton profile image
Uriel Bitton • Edited

First of all you will never get questions like this when applying to any job today. They are just way too specific and no interviewer cares to ask you this as you can simply google the answers.

In my experience, interviewers ask two things during interviews. One can be hypothetical questions like "how would authenticate a user in this scenario"? Or "how do you handle login in your app"? And these would be asked in a very general way. They won't ask you to explain how an arrow function works or what a split function does...

The second question could be "say I wanted to remind a user to check their email, how would I achieve that with react/vanilla js/java etc.

In a third likely scenario you could also be asked the classic question "how do you see yourself working with a team of x developers", "would you refactor or continue code that is poorly written as a new team member" Etc.

Knowing basic and advanced js concepts is definitely important and you should master them as much as possible but these specific concepts are ones you need once you do get the job but very rarely during the interview process.

Collapse
 
syeo66 profile image
Red Ochsenbein (he/him)

Actually I got a lot of those questions as a senior developer. And to be frank I found it to be quite insulting. I mean I can write code in at least 10 programming languages. The languages and their special cases usually don't matter much. The concepts at the root (and from a birds eye view) however do matter.

 
Sloan, the sloth mascot
Comment deleted
 
Sloan, the sloth mascot
Comment deleted
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
lucastvms profile image
Lucas Vieira

Then what about developers itself? We can find almost everything that we need in the internet, so the value of a developer is 0? In my opinion knowing these concepts shows that the developer knows more than just "copy and paste" code (what is common even with complete projects).

 
Sloan, the sloth mascot
Comment deleted
Collapse
 
johandalabacka profile image
Johan Dahl

Sugar on top of promises for folks that don't fully understand async code.

So it’s just something you use until you understand asynchronous code. After that you start to use then() and catch() or callbacks?

Collapse
 
lexiebkm profile image
Alexander B.K.

"Whats prototype and prototypal inheritance"
This is one of the topics I have been suspending, because I have been busy on trying with a few compiled languages for backend; I will resume on learning this topic in appropriate time. As far as I know, eventhough ES6 provides classes for OOP, javascript OOP is still prototype based.
I think you miss one important thing : strict mode.
For Node.js, it is also important to know Event Loop in addition to promise and async/await.

Collapse
 
__junaidshah profile image
Junaid

event loop is definitely a good question and asked many a times

Collapse
 
__junaidshah profile image
Junaid

I definitely understand your point of view here , and i totally agree
Althoughthe inteviewer sometime can ask these questions indirectly rather, they can also give you a challenge and ask can you solve this via lets say a promise based approach etc .

Collapse
 
dmitryame profile image
Dmitry Amelchenko