Extract key value and Index of Non-iterable object

const object1 = {
a: ‘somestring’,
b: 42
};

Object.entries(object1).map(([key,value],index)=>{
console.log(${key}: ${value} ${index});
})

“a: somestring 0”
“b: 42 1”

Do you have a question?

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.