//判断有没有设置 'pull', 'put' 如果没有 则添加 'pull', 'put' 属性并且设置为真
['pull', 'put'].forEach(function(key) {
if (!(key in group)) { //
group[key] = true; //将为group对象添加两个属性'pull', 'put' 并且为true
}
});
//判断有没有设置 'pull', 'put' 如果没有 则添加 'pull', 'put' 属性并且设置为真
['pull', 'put'].forEach(function(key) {
if (!(key in group)) { //
group[key] = true; //将为group对象添加两个属性'pull', 'put' 并且为true
}
});
本文标题:关于each()方法的一种使用
本文链接:https://www.haomeiwen.com/subject/ylphkctx.html
网友评论