美文网首页
关于each()方法的一种使用

关于each()方法的一种使用

作者: 白云若水 | 来源:发表于2019-07-10 15:39 被阅读0次

    //判断有没有设置 '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