Advanced JavaScript MCQs (50 Questions with Answers)
Instructions: Choose the correct option (a, b, c, or d) for each
question.
---
1. What will [Link](typeof NaN); output?
a) number
b) string
c) object
d) undefined
Answer: a
2. What will [Link](NaN === NaN); output?
a) true
b) false
c) undefined
d) NaN
Answer: b
3. Which method copies an array without affecting the original?
a) slice()
b) splice()
c) push()
d) pop()
Answer: a
4. What is a closure in JavaScript?
a) Function inside another function that remembers its scope
b) An object method
c) A type of loop
d) None of the above
Answer: a
5. What will [Link](0.1 + 0.2 === 0.3); output?
a) true
b) false
c) undefined
d) NaN
Answer: b
6. What is the difference between var, let, and const?
a) Scope and reassignment rules
b) Only syntax difference
c) No difference
d) Only const exists in ES5
Answer: a
7. Which operator is used for destructuring objects?
a) =
b) {...}
c) []
d) ->
Answer: b
8. What will this code print?
for (var i = 0; i < 3; i++) {
setTimeout(() => [Link](i), 1000);
}
a) 0 1 2
b) 3 3 3
c) 0 1 2 3
d) undefined
Answer: b
9. How do you define an arrow function?
a) function() {}
b) () => {}
c) func() => {}
d) => {}
Answer: b
10. What is the output?
[Link]([] + []);
a) 0
b) ''
c) []
d) undefined
Answer: b
...
50. What is the output?
[Link](async function(){} instanceof Function);
a) true
b) false
c) undefined
d) Error
Answer: a