61. What is the output of console.log([] + {})?
- a) "[object Object]"
- b) "{}"
- c) TypeError
- d) 0
Test your knowledge of JavaScript with these interactive multiple-choice questions.
61. What is the output of console.log([] + {})?
62. Which method executes a function after a specified delay?
setTimeout() schedules a one-time execution after the delay (in milliseconds).
63. What is the prototype of an object created with Object.create(null)?
Object.create(null) creates an object with no prototype chain.
64. What does console.log(+"Infinity") output?
+ converts the string "Infinity" to the number Infinity.
65. Which method returns the primitive value of an object?
valueOf() is called when an object needs to be converted to a primitive value.
66. What is the output of console.log(1 == "1")?
==) performs type coercion, converting the string "1" to the number 1.
67. Which statement about let and const is true?
const allows reassignmentlet doesn't support temporal dead zonelet and const are block-scoped and hoisted but cannot be accessed before declaration (temporal dead zone).
68. What is the output of console.log(typeof (function(){}()))?
undefined.
69. Which method creates a new array with all sub-array elements concatenated recursively?
flat(depth) flattens nested arrays up to the specified depth (default: 1).
70. What does console.log(new String("test") === "test") output?
String object and primitive string are of different types (object vs string).
71. Which operator has the highest precedence?
() has the highest precedence, followed by member access . and new.
72. What is the output of console.log(!!new Boolean(false))?
new Boolean(false) is an object (truthy), so !! converts it to true.
73. Which method prevents extensions to an object?
Object.preventExtensions() disables adding new properties (but allows modifying/deleting existing ones).
74. What is the output of console.log(+"")?
+ coerces an empty string to 0.
75. Which method returns the first element that satisfies a condition?
find() returns the first matching element (or undefined if none).
76. What is the output of console.log(3 > 2 > 1)?
(3 > 2) > 1 → true > 1 → 1 > 1 → false.
77. Which symbol is used as a placeholder for awaiting promises?
await pauses execution until a promise settles (must be inside an async function).
78. What is the output of console.log(Number("123abc"))?
Number() returns NaN for strings with non-numeric characters.
79. Which method returns a string representation of an array?
join() allows custom separators.
80. What is the output of console.log(typeof class {})?
"function".