摘要:
function factorial(num){ debugger return num==1?1:num*factorial(num-1); } let proxy=new Proxy(factorial,{ apply(func,obj,args){ debugger console.time( 阅读全文
摘要:
const user={ // name:"hundsun", // age:16 data:{name:"yss",age:12}, //访问器批量设置属性 set site(value){ [this.name,this.age] =value.split(","); }, get site() 阅读全文
摘要:
const user={ // name:"hundsun", // age:16 data:{name:"yss",age:12}, list:[ {price:12}, {price:12}, {price:13} ], //访问其伪造属性操作 get total(){ return this. 阅读全文
摘要:
const user={ // name:"hundsun", // age:16 data:{name:"yss",age:12}, set age(value){ //使用访问其保护数据 if(typeof value !=='number'){ throw new Error("error") 阅读全文
摘要:
const user={ name:"hundsun", age:16 } console.log(Object.isSealed(user));//判断对象是否被封闭 Object.seal(user);//封闭对象API console.log(Object.isSealed(user)); O 阅读全文