Filter then display

Take your time, follow the code and check your understanding.

Move blocks into orderArrays
  1. console.log(labels);
  2. const labels = even.map(n => "Number " + n);
  3. const even = values.filter(n => n % 2 === 0);
  4. const values = [1, 2, 3, 4];
Your answer3 min · no timer

Drag blocks, or use the arrow buttons. Keep the displayed indentation. This task uses the taught sequence; other equivalent programs may also be valid.

Show solution and explanation

Each declaration depends on the value created by the preceding line.

const values = [1, 2, 3, 4];
const even = values.filter(n => n % 2 === 0);
const labels = even.map(n => "Number " + n);
console.log(labels);