I'm new to javascript and have a question : i want to change keys if their value is number for example. What's wrong with my code?
const order = {
wine : 100,
vodka : 200,
beer : 300,
whisky : "not in stock"
};
function change(obj) {
for (var prop in obj) {
if (typeof obj[prop] === "number") {
prop = "is number";
}
}
}
change(order);
console.log(order);
i want output to be
is number : 100,
is number : 200,
is number: 300,
whisky : "not in stock"