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: The 'new' keyword is used to create an instance of a class.
Answer: The logical NOT operator reverses the boolean value, so !true is false.
Answer: All of these methods can be used to get the current URL.
Answer: The number is coerced to a string, resulting in concatenation: '55'.
Answer: toLowerCase() converts a string to lowercase letters.
Answer: Multiplication has higher precedence, so 3 * 4 = 12, then 2 + 12 = 14.
Answer: eval() evaluates JavaScript code represented as a string.
Answer: === checks both value and type. 0 is a number, false is a boolean.
Answer: All of these methods can be used to find the maximum value in an array.
Answer: Arrow functions are a type of function, so typeof returns 'function'.
Answer: Both 'submit' and 'onsubmit' can be used to handle form submissions.
Answer: 10 divided by 3 leaves a remainder of 1.
Answer: import is used in ES modules, while require is used in CommonJS.
Answer: The string '3' is coerced to a number, so 2 * 3 = 6.
Answer: toUpperCase() converts a string to uppercase letters.
Answer: The string '5' is coerced to a number, so 5 - 2 = 3.
Answer: All of these methods can be used to add properties to an object.
Answer: 3 > 2 is true (1), then 1 > 1 is false.
Answer: In browsers, window has timer functions; in Node.js, global has them.
Answer: 1 + 2 + 3 = 6, then 6 + '4' = '64' (string concatenation).