LearnFrenzy
Sign in Take a free test

Arrow Functions · Predict the Output · Question 7

arguments inside an arrow Answer, explanation & discussion

  • Output
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 7 Back to Exercise

What does the following JavaScript code print (console output, as in Node.js)?

main.js
function outer() {
  const inner = () => arguments[0];
  return inner("ignored");
}
console.log(outer("outer-arg"));
  • A outer-arg Correct
  • B ignored
  • C undefined
  • D ReferenceError
Correct Answer: Option A

The arrow has no arguments object of its own, so the name resolves to outer's arguments.

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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links