141. What is the output of console.log(+"0x10")?
- a) 16
- b) "0x10"
- c) 10
- d) NaN
+ converts hexadecimal "0x10" to decimal 16.
Test your knowledge of JavaScript with these interactive multiple-choice questions.
141. What is the output of console.log(+"0x10")?
+ converts hexadecimal "0x10" to decimal 16.
142. Which method creates a new array with the results of calling a function on every element?
map() transforms each element and returns a new array.
143. What is the output of console.log(typeof (() => {}))?
"function".
144. Which operator returns the remainder of a division?
%) returns the remainder (e.g., 10 % 3 → 1).
145. What is the output of console.log(0 || "Hello")?
||) returns the first truthy value ("Hello" in this case).
146. Which method checks if an array includes a value?
includes() returns true if the value exists in the array.
147. What is the output of console.log(+"")?
+ coerces an empty string to 0.
148. Which method returns the first element that satisfies a condition?
find() returns the first matching element (or undefined if none).
149. What is the output of console.log(3 > 2 > 1)?
(3 > 2) > 1 → true > 1 → 1 > 1 → false.
150. Which symbol is used as a placeholder for awaiting promises?
await pauses execution until a promise settles (must be inside an async function).
151. What is the output of console.log(Number("123abc"))?
Number() returns NaN for strings with non-numeric characters.
152. Which method returns a string representation of an array?
join() allows custom separators.
153. What is the output of console.log(typeof class {})?
"function".
154. Which method prevents extensions to an object?
Object.preventExtensions() disables adding new properties (but allows modifying/deleting existing ones).
155. What is the output of console.log(!!new Boolean(false))?
new Boolean(false) is an object (truthy), so !! converts it to true.
156. Which operator has the highest precedence?
() has the highest precedence, followed by member access . and new.
157. What does console.log(new String("test") === "test") output?
String object and primitive string are of different types (object vs string).
158. 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).
159. What is the output of console.log(typeof (function(){}()))?
undefined.
160. 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).