JavaScript Questions
50 of the most popular JavaScript entry-level interview questions
(Taken from this Twitter thread)
- What are the JavaScript data types?
- What is the difference between local and global variables?
- What is the difference between “=”, “==”, and “===”?
- Explain the .pop() and .push() methods
- What are higher order functions (HOF)?
- Write a loop that prints every number divisible by 5 from 1 - 200
- What is the difference between the “break” and “continue” statements?
- What is JSON?
- What are arrow functions?
- What is TypeScript and how does it differ from JavaScript?
- What are Promises? Can you use one in an example?
- What is async/await?
- What is the DOM?
- What is a variable?
- What is an array?
- What is an object?
- What is a function?
- How would you check if an object has a specific property?
- What is the difference between var, const, and let?
- How would you check if an array contains a specific item?
- How would you check the length of an array?
- What is the difference between a for loop and a while loop?
- When would you use “&&”? When would you use “||”?
- What is a ternary operator?
- What is the difference between Java and JavaScript?
- How do you create an object in JavaScript?
- How do you create an array in JavaScript?
- Write a function that accepts 2 arguments and returns the product of those arguments
- What is this?
- What is a callback?
- What are the variable naming conventions?
- How do you read a cookie?
- What is the difference between local storage and session storage?
- What is the difference between null and undefined?
- Name some of the JavaScript frameworks
- What are exports and imports?
- How do you access an HTML element from JavaScript?
- Given a string, reverse each word in the string
- What does “use strict” do?
- What is cross site scripting (XSS)?
- Can you explain the Gitflow workflow?
- How do you update your local repo using Git?
- What is cache busting and how do you achieve it?
- What is a RESTful Web Service?
- Write some JS code that creates a new HTML <p> element with some text and appends it to the document body
- Describe what “dynamic typing” means in JavaScript
- 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
- What are the disadvantages of JavaScript?
- How do you write tests for JavaScript code?
- What is npm?