Photo of 64 Javascript interview questions from top tech companies to practice

64 JavaScript Interview Questions to Practice

JavaScript is an incredibly versatile language that many companies, big and small, use in their stack. It is one of the top programming languages for software engineers as well as front-end, back-end, and full-stack developers. If you are preparing to interview for one of these types of roles, you should spend time practicing the JavaScript interview questions you will be asked.

We have worked with hundreds of software engineers and developers on their job search, spending a lot of time on their technical interview preparation, so we created this list of 64 JavaScript interview questions from real tech companies that can be used for practice and tips to keep in mind when you go into the interview.

JavaScript interview questions

  1. Meta question – Explain the concept of ES6 promises to a 5-year-old.  
  2. Airbnb question – What are the advantages of using ES6 maps over objects? What about using ES6 sets over arrays?  
  3. Google question – Given 2 identical DOM trees (but not equal) and one element of the first DOM tree, how would you find this element in the second DOM tree?  
  4. Twitter question – Can you write a function that deeply flattens an array?  
  5. Netflix question – Given a picture, how would you hide/show a child’s picture hovering on this parent?  
  6. LinkedIn question – How would you ensure clicking on a picture would go to a specific link? How would you ensure the child is positioned in the top right of the parent picture?  
  7. Microsoft question – If you were building a search tool and wanted search results to pop up as you typed but the server call was taxing, write a function that gets called on every key down but calls the server when the user stops typing for 400ms.  
  8. Google question – Given an input array and another array that describes a new index for each element, mutate the input array so that each element ends up in their new index. Discuss the runtime of the algorithm and how you can be sure there won’t be infinite loops.  
  9. Facebook question – In JavaScript, write a function that takes an array as input that can contain both ints and more arrays (which can also contain an array or int) and return the flattened array.
  10. Google question – How do you make a function that only calls input function f every 50 milliseconds?  
  11. Twitter question – How do you make a function that takes f and returns a function that calls f on a timeout?  
  12. Airbnb question – Write a function reveal() that outputs the number of tiles shown when a user clicks on a tile. Each tile shows the number of bombs as its neighbor. If the user clicks on a tile that is a bomb, the game is over. If that tile is 0, reveal all its neighbors. 
  13. Microsoft question – Describe what happens when a user clicks a link in a browser.  
  14. Netflix question – Design a webpage which can auto-post new posts when you reach the bottom of the page by using JavaScript. 
  15. Google question – Write the code to find the balance point of the array.

More Javascript interview questions

  1. IBM question – Describe your experience developing AI applications.  
  2. Groupon question – Implement a to-do list’s delete method on a website.
  3. eBay question – What is the difference between null and undefined?
  4. Meta question – Are Javascript and JScript the same? Are Typescript and Javascript the same?
  5. Airbnb question – Name some of the Javascript frameworks.
  6. Twitter question – Explain the typeof operator.
  7. IBM question – What are anonymous functions in Javascript? What is the difference between an anonymous function and a named function?
  8. Google question – What are self executing functions?
  9. Uber question – What is a function callback?
  10. eBay question – What happens when the recursion calling is applied to two functions?
  11. Netflix question – Explain the term: closure.
  12. Facebook question – Explain the terms: synchronous and asynchronous code.
  13. Microsoft question – How do you add an element at the beginning of an array? How do you add one at the end?
  14. IBM question – What is Ajax? What are the disadvantages of Ajax? Which are the two methods used for cross domain Ajax calls?
  15. AMD question – Differentiate between == and === 
  16. Groupon question – What is JSON?
  17. Fiserv question – What is the significance of, and reason for, wrapping the entire content of a JavaScript source file in a function block?

Even more JavaScript interview questions

  1. Twitter question – What is the significance, and what are the benefits, of including ‘use strict’ at the beginning of a JavaScript source file?
  2. Facebook question – What is NaN? What is its type? How can you reliably test if a value is equal to NaN?
  3. Airbnb question – What will the code below output? Explain your answer.
    1. console.log(0.1 + 0.2);
    2. console.log(0.1 + 0.2 == 0.3);
  4. LinkedIn question – Discuss possible ways to write a function isInteger(x) that determines if x is an integer.
  5. Microsoft question – Write a simple function (less than 160 characters) that returns a boolean indicating whether or not a string is a palindrome.
  6. Google question – What is the difference between textContent and innerText?
  7. Uber question – What is the difference between HTMLCollection and NodeList?
  8. Netflix question – How can an HTMLCollection be traversed?
  9. Fiserv question – What is the difference between childNode and children?
  10. Twitter question – What is the difference between firstChild and firstElementChild?
  11. Facebook question – Name the two functions that are used to create an HTML element dynamically.
  12. Netflix question – What is the difference between remove() and removeChild()?
  13. Fiserv question – What is an event bubbling in Javascript?
  14. Twitter question – Implement an autocomplete system: given a query string s and a set of all possible query strings, return all strings in the set that have s as a prefix.
  15. Microsoft question – You run an e-commerce website and want to record the last N order ids in a log. Implement a data structure to accomplish this, with the following API:
    1. record(order_id): adds the order_id to the log
    2. get_last(i): gets the ith last element from the log. i is guaranteed to be smaller than or equal to N. You should be as efficient with time and space as possible.
  16. LinkedIn question – How can we include jQuery library in ASP.Net project?
  17. Uber question – In what scenarios jQuery can be used?
  18. Airbnb question – What is the difference between find and children methods?
  19. Groupon question – What is jQuery connect?
  20. Facebook question – How do you use connect?
  21. Google question – What are the features of jQuery that has been used in web applications?
  22. eBay question – What are the browser related issues for jQuery?
  23. Facebook question – How many times would `addEventListener(‘scroll’, handleScroll);` run as the user looks at their news feed? And what would be user experience if the `handleScroll` function takes 100ms to execute.  Do we need to add a jQuery file in both the master and content page?
  24. Twitter question – What are the basic selectors in jQuery?
  25. Dessault Systemes question – What is the use of the method?
  26. Groupon question – What is the use of each function in jQuery?
  27. Netflix question – What is the difference between size and length of jQuery?
  28. Google question – Can we add more than one ‘document.ready’ function to a page?
  29. Microsoft question – What is the use of jQuery load method?
  30. Airbnb question – What are the 4 parameters used for the jQuery Ajax method?
  31. Meta question – Why are jQuery filters used?
  32. Dessault Systemes question – Which testing libraries would you use to test jQuery functions?

Once you have mastered the technical questions that come up in the interviews, you should spend time readying yourself so you are confident and successful. Our mentors work with candidates every day who have the right hard skills, but struggle with the soft skills needed to impress the interviewer. Use these tips to help you as you prepare.

  • Don’t jump right in, ask questions first

You might feel like you need to start coding as soon as you get the problem in front of you, but we recommend taking 15-30 seconds to read through fully and ask some questions that can help make sure you are on the right track. “Are repetitions allowed?” or “Do you want to return permutations or combinations?” are good examples of these types of clarifying questions.

  • Proactively show what you know

As you work, give the interviewer quick tidbits of information so they can get a sense of your breadth of knowledge. While it might take a little bit of time away from coding, it greatly reduces potentially uncomfortable silences, especially in times when you are thinking and not actively working.

  • Give context on your decisions

Similarly, you should be walking the interviewer through your decisions and explain why you are doing what you are doing. Providing the reasoning behind your choices will give them more insight into your thought process, which can be especially beneficial if you have made a mistake in your work.

  • Ask collaborative questions to get guidance

While you work, you might find that you are hitting a wall. You can take this moment to bring your interviewer into your issue. Just try to avoid using the word “hint.” Instead, make collaborative statements like “my assumptions are X and Y, I’m thinking of doing Z. But I’m struggling with solving [problem].” You can also try questions like,

  • I was wondering if you had any thoughts.
  • Do you think I’m going down the right direction?
  • Do you think my assumptions are incorrect?

With these JavaScript interview questions & tips in your back pocket, you should be more than prepared for your next technical onsite interview. Feel like you need more help? Check out these resources to practice more software engineering interview questions.

You can also check out our other interview question lists:

Pathrise is a career accelerator that works with students and professionals 1-on-1 so they can land their dream job in tech. With these tips and guidance, fellows have seen their interview scores double.

If you want to work with any of our mentors 1-on-1 to get help with your software engineer interviews or with any other aspect of the job search, become a Pathrise fellow.

Apply today

Brian Wong

Brian Wong is an experienced senior software engineer and has worked at top bay area startups and organizations. In his free time, Brian works with Pathrise SWE fellows to help them land their dream job and learn insider tips on how to ace technical interviews.

Leave a Reply

Your email address will not be published. Required fields are marked *