LearnFrenzy
Sign in Take a free test

Array Methods · Find the Error · Question 2

Error: unclosed call Answer, explanation & discussion

  • Find the error
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 2 Back to Exercise

JavaScript refuses to run the code below. Which statement correctly describes the problem?

main.js
const ages = [12, 25, 17, 40];
const adults = ages.filter((a) => a >= 18;
console.log(adults);
  • A SyntaxError: the filter( call is never closed – add ) before the semicolon Correct
  • B It prints [ 25, 40 ]
  • C It prints []
  • D TypeError
Correct Answer: Option A

The semicolon appears while the argument list is still open. ages.filter((a) => a >= 18); fixes it.

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