Question 2
Back to Exercise
Which elements does arr.filter(fn) keep?
- A Those for which fn returns exactly true
- B Those for which fn returns a truthy value Correct
- C The first element only
- D Those for which fn returns undefined
Correct Answer: Option B
The callback's result is converted to a boolean. That is why filter(Boolean) removes all falsy values.
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!