- 遍历给定对象的key
- 识别key是否属于该对象
- 如果是,则获取key的值
forEachObject = (obj,fn) => {
for(let property in obj){
if(obj.hasOwnProperty(property)){
fn(property,obj[property])
}
}
}
forEachObject = (obj,fn) => {
for(let property in obj){
if(obj.hasOwnProperty(property)){
fn(property,obj[property])
}
}
}
本文标题:遍历对象
本文链接:https://www.haomeiwen.com/subject/mcrldctx.html
网友评论