How to change key in JS object
Posted: 30 Oct 2020, 06:15
I have a question: i want to change keys into a JavaScript object if their value is number, for example, I have the following object:
I want to get this result:
Code: Select all
const order = {
wine : 100,
vodka : 200,
beer : 300,
whisky : "not in stock"
};
Code: Select all
const order = {
is_nr_100 : 100,
is_nr_200 : 200,
is_nr_300 : 300,
whisky : "not in stock"
};