JavaScript Questions

50 of the most popular JavaScript entry-level interview questions

(Taken from this Twitter thread)

  1. What are the JavaScript data types?
  2. What is the difference between local and global variables?
  3. What is the difference between “=”, “==”, and “===”?
  4. Explain the .pop() and .push() methods
  5. What are higher order functions (HOF)?
  6. Write a loop that prints every number divisible by 5 from 1 - 200
  7. What is the difference between the “break” and “continue” statements?
  8. What is JSON?
  9. What are arrow functions?
  10. What is TypeScript and how does it differ from JavaScript?
  11. What are Promises? Can you use one in an example?
  12. What is async/await?
  13. What is the DOM?
  14. What is a variable?
  15. What is an array?
  16. What is an object?
  17. What is a function?
  18. How would you check if an object has a specific property?
  19. What is the difference between var, const, and let?
  20. How would you check if an array contains a specific item?
  21. How would you check the length of an array?
  22. What is the difference between a for loop and a while loop?
  23. When would you use “&&”? When would you use “||”?
  24. What is a ternary operator?
  25. What is the difference between Java and JavaScript?
  26. How do you create an object in JavaScript?
  27. How do you create an array in JavaScript?
  28. Write a function that accepts 2 arguments and returns the product of those arguments
  29. What is this?
  30. What is a callback?
  31. What are the variable naming conventions?
  32. How do you read a cookie?
  33. What is the difference between local storage and session storage?
  34. What is the difference between null and undefined?
  35. Name some of the JavaScript frameworks
  36. What are exports and imports?
  37. How do you access an HTML element from JavaScript?
  38. Given a string, reverse each word in the string
  39. What does “use strict” do?
  40. What is cross site scripting (XSS)?
  41. Can you explain the Gitflow workflow?
  42. How do you update your local repo using Git?
  43. What is cache busting and how do you achieve it?
  44. What is a RESTful Web Service?
  45. Write some JS code that creates a new HTML <p> element with some text and appends it to the document body
  46. Describe what “dynamic typing” means in JavaScript
  47. Create a JS object for a person with first name, last name, and id number attributes and a function to return the person’s full name
  48. What are the disadvantages of JavaScript?
  49. How do you write tests for JavaScript code?
  50. What is npm?