What will be the output of the following code?
const numbers = [1, 2, 3, 4, 5];
let result = '';
numbers.forEach(num => {
if (num % 2 === 0) {
result += num + ' ';
}
});
console.log(result.trim());
What will be the output of the following code?
const numbers = [1, 2, 3, 4, 5];
let result = '';
numbers.forEach(num => {
if (num % 2 === 0) {
result += num + ' ';
}
});
console.log(result.trim());