2022年1月23日
摘要: function factorial(num){ debugger return num==1?1:num*factorial(num-1); } let proxy=new Proxy(factorial,{ apply(func,obj,args){ debugger console.time( 阅读全文
posted @ 2022-01-23 18:00 weakup 阅读(326) 评论(0) 推荐(0) 编辑
摘要: const user={ // name:"hundsun", // age:16 data:{name:"yss",age:12}, //访问器批量设置属性 set site(value){ [this.name,this.age] =value.split(","); }, get site() 阅读全文
posted @ 2022-01-23 14:57 weakup 阅读(19) 评论(0) 推荐(0) 编辑
摘要: const user={ // name:"hundsun", // age:16 data:{name:"yss",age:12}, list:[ {price:12}, {price:12}, {price:13} ], //访问其伪造属性操作 get total(){ return this. 阅读全文
posted @ 2022-01-23 14:49 weakup 阅读(14) 评论(0) 推荐(0) 编辑
摘要: const user={ // name:"hundsun", // age:16 data:{name:"yss",age:12}, set age(value){ //使用访问其保护数据 if(typeof value !=='number'){ throw new Error("error") 阅读全文
posted @ 2022-01-23 14:37 weakup 阅读(13) 评论(0) 推荐(0) 编辑
摘要: const user={ name:"hundsun", age:16 } console.log(Object.isSealed(user));//判断对象是否被封闭 Object.seal(user);//封闭对象API console.log(Object.isSealed(user)); O 阅读全文
posted @ 2022-01-23 14:25 weakup 阅读(27) 评论(0) 推荐(0) 编辑