Question from the Javascript - Fundamentals test

Understanding the differences between `map()` and `forEach()` methods in JavaScript

Medium

Understanding the differences between map() and forEach() methods in JavaScript

const numbers = [1, 2, 3, 4, 5];

const doubledNumbers1 = numbers.forEach((num) => {
  return num * 2;
});

const doubledNumbers2 = numbers.map((num) => {
  return num * 2;
});
Author: Vincent CotroStatus: PublishedQuestion passed 2940 times
Edit
70
Community EvaluationsNo one has reviewed this question yet, be the first!