bahmutov's notebooks

  • Fun JavaScript Workshop - /bahmutov/fun
    Last edited 7 years ago
    // Problem: given an array of numbers, // multiply even values by a constant and print the result var numbers = [3, 2, 8] var constant = 2 // should output 4 16 // example solution using Array methods numbers.filter(x => x % 2 === 0).map(x => constant * x).forEach(x => console.log(x))