[Solved] .forEach() Javascript function is returning an Array?


It doesn’t return anything. You can check that by logging the result of the forEach call:

var arr = [1, 3, 2];
var arr_temp = [];

console.log(arr.forEach(function (i) {
  return arr_temp.push(i + i);
})); // undefined

console.log(arr_temp); // 2, 6, 4

3

solved .forEach() Javascript function is returning an Array?