let menu = {
width: 200,
height: 300,
title: "My menu"
};
function multiplyNumeric(obj) {
for (let key in obj) {
if (typeof obj[key] == "number") {
obj[key] *= 2;
}
}
}
multiplyNumeric(menu);
alert(menu);
console.log(menu)
I ran into this problem.
so at the end of the code when I do alert(menu); I get [object Object].
but when I do console.log(menu); I get { width: 400, height: 600, title: 'My menu' }. Which is what i wanted. So what's causing the difference?