Question 15
Back to Exercise
What does the following JavaScript code print (console output, as in Node.js)?
const result = ((x) => x * 3)(7);
const config = (() => ({ mode: "prod", debug: false }))();
console.log(result, config.mode);
- A 7 prod
- B 21 undefined
- C SyntaxError
- D 21 prod Correct
Correct Answer: Option D
Wrapping an arrow in parentheses and calling it immediately works like an IIFE.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!