I have a data structure similar to:
var object = {
name: "a",
number: "1",
mission: ['a','b','c']
}
Now I want to update them into the database so I need to walk them.
I tried:
object.forEach(function(value, key, map){
console.log('value: ' + value + ', key: ' + key + ', map:' + map);
});
And then the console report an error: object.forEach is not a function
Try this,
Object.keys(object).forEach(key=>{
console.log(key ,object[key]);
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With