(精华)2020年7月5日 JavaScript高级篇 ES6(Reflect)

let obj = {name:'tony'}
console.log('name' in obj);
console.log(Reflect.has(obj,'name'));
//Reflect 的api 和proxy代理的api通用 
let obj = {
    name:'Chris'
}
let result = Reflect.get(obj,'name')
console.log(result);
let obj2 = {
    get he() {
        return this.name + this.pro
    }
}
let re = {
    name: 'tony',
    pro: '怕老婆'
}
let result = Reflect.get(obj2, "he", re)
console.log(result);

你可能感兴趣的:(#,Javascript,高级篇,javascript,前端)