What value is printed when executing the following code?
let max = -Infinity;
const arr = [-2, -1, 0, 1, 2];
arr.forEach(item => {
if (item > max) max = item;
});
console.log(max);
What value is printed when executing the following code?
let max = -Infinity;
const arr = [-2, -1, 0, 1, 2];
arr.forEach(item => {
if (item > max) max = item;
});
console.log(max);