QuestenaPractice that shows what to review next
Question 50

Given [1, 2, 3, 4].filter(x => x > 2), which result is returned?

  1. [false, false, true, true]
  2. [3, 4]Correct answer
  3. [1, 2]
  4. true

Explanation

filter keeps the original element values whose callback results are truthy, so it returns 3 and 4 in a new array. It does not collect the callback's true and false results as map would collect callback outputs.

Continue with this test

Start practice
Question 50: Given [1, 2, 3, 4].filter(x => x > 2), which result is… · JavaScript Fundamentals · Questena