25 JavaScript QUIZ Questions Test your Knowledge!
JavaScript Developer WorldWide
Join the JavaScript Developers worldwide JavaScript Developers JavaScript Coders JavaScript Freelancers
Learn more about JavaScript Download PDF Guide at https://basescripts.com/25-javascript-quiz-questions-test-your-knowledge
Question 1
Q: What is the output of "10" + 20 in JavaScript?
A: 2. "1020"
Question 2
Q: Which method can be used to convert JSON data to a JavaScript object?
A: 1. JSON.parse()
Question 3
Q: What does the map() method do?
A: 1. Modifies each item in an array and returns a new array.
Question 4
Q: What will console.log(typeof null) output?
A: 2. "object"
Question 5
Q: How do you create a new Promise in JavaScript?
A: 1. new Promise()
Question 6
Q: Which of the following is not a valid way to declare a variable in JavaScript?
A: 4. int x = 1;
Question 7
Q: What is the purpose of the Array.reduce() method?
A: 1. To execute a reducer function on each element of the array, resulting in a single output value.
Question 8
Q: Which operator is used to check both value and type?
A: 3. ===
Question 9
Q: What will console.log(0.1 + 0.2 == 0.3) output?
A: 2. false
Question 10
Q: What is the purpose of the splice() method in arrays?
A: 3. To add/remove elements from an array.
Question 11
Q: How can you get the number of milliseconds elapsed since January 1, 1970?
A: 2. Date.now()
Question 12
Q: What does the this keyword refer to inside an arrow function?
A: 4. The parent scope
Question 13
领英推荐
Q: What are higher-order functions in JavaScript?
A: 1. Functions that operate on other functions.
Question 14
Q: What is event delegation in JavaScript?
A: 2. Handling an event at a parent element rather than the element itself.
Question 15
Q: Which HTML element is used to embed JavaScript?
A: 3. <script>
Question 16
Q: What is the main use of the async keyword in JavaScript?
A: 2. To mark a function as asynchronous.
Question 17
Q: What is the output of console.log("2" + 2 * "2")?
A: 4. "42"
Question 18
Q: How can you stop the execution of a setInterval timer?
A: 1. clearInterval()
Question 19
Q: What is the correct way to create an object in JavaScript?
A: 4. Both 1 and 3.
Question 20
Q: What will be the result of console.log(!!"false")?
A: 1. true
Question 21
Q: How do you find the minimum of two numbers x and y in JavaScript?
A: 2. Math.min(x, y)
Question 22
Q: Which statement creates a new function in JavaScript?
A: 4. All of the above.
Question 23
Q: What is the use of the finally statement in a try-catch block?
A: 2. To execute code whether an exception is thrown or not.
Question 24
Q: How do you declare a static method in a JavaScript class?
A: 1. static methodName() {}
Question 25
Q: What is the correct syntax for importing a module in ES6?
A: 1. import myModule from "module.js";