JavaScript
Practice JavaScript MCQs covering variables, data types, operators, functions, objects, arrays, DOM manipulation, events, ES6+, asynchronous programming, APIs, and modern JavaScript concepts.
3
Topics
304
Total MCQs
JavaScript
Practice JavaScript MCQs covering variables, data types, operators, functions, objects, arrays, DOM manipulation, events, ES6+, asynchronous programming, APIs, and modern JavaScript concepts.
Answer: Both ** operator and Math.pow() can be used for exponentiation.
Answer: NaN is not equal to NaN, even itself. Use isNaN() to check.
Answer: setTimeout() executes a function once after a delay, while setInterval() repeats it.
Answer: 3 < 2 is false (0), then 0 < 1 is true. The expression is evaluated left to right.
Answer: Falsy values include false, 0, '', null, undefined, NaN.
Answer: map() creates a new array by applying a function to each element.
Answer: Due to type coercion, [] == ![] evaluates to true.
Answer: break is used to exit a loop entirely. continue skips the current iteration.
Answer: NaN is of type 'number', even though it represents 'Not a Number'.
Answer: join() and toString() both convert arrays to strings, but join() allows custom separators.
Answer: 10 > 9 is true (1), then 1 > 8 is false.
Answer: window is the global object in browsers, containing document and other properties.
Answer: filter() creates a new array with elements that satisfy a provided condition.
Answer: Both strings are coerced to numbers, and 5 - (-1) = 6.
Answer: try, catch, and throw are all used in exception handling.
Answer: 1 < 2 is true (1), then 1 < 3 is true.
Answer: shift() removes and returns the first element of an array.
Answer: The exponentiation operator ** computes 2 to the power of 3, which is 8.
Answer: unshift() adds elements to the beginning of an array.
Answer: undefined and null are loosely equal (==) but not strictly equal (===).