Javascript Object 遍历
- 预数据
var map_object={"a": 1, "b":2 }
- 遍历
for (const key in map_object) { console.log(key, ' - ', map_object[key]) } Object.keys(map_object).forEach((key) => { console.log(key, ' - ', map_object[key]) })
var map_object={"a": 1, "b":2 }
for (const key in map_object) {
console.log(key, ' - ', map_object[key])
}
Object.keys(map_object).forEach((key) => {
console.log(key, ' - ', map_object[key])
})