美文网首页
ES5 Reflect

ES5 Reflect

作者: 纱云 | 来源:发表于2021-12-08 10:05 被阅读0次

    const obj = {
    name:'zzz',
    age:'345'
    }
    console.log(Reflect.has(obj,'name'));
    console.log(Reflect.deleteProperty(obj,'age'));
    console.log(Reflect.ownKeys(obj));

    let dic = {
            "hello": "nihao",
            "godd": "hao"
        }
        dic = new Proxy(dic, {
            get(target, phrase) {
                if (phrase in target) {
                    return target[phrase]
                } else {
                    return phrase;
                }
            }
        })

    相关文章

      网友评论

          本文标题:ES5 Reflect

          本文链接:https://www.haomeiwen.com/subject/dghaxrtx.html