2022年1月28日
摘要:
let hd ={ action:{}, get proto(){ return this.action }, set proto(obj){ if(obj instanceof Object){ this.action=obj; } } } hd.proto="abl"; hd.proto={vi
阅读全文
posted @ 2022-01-28 17:44
weakup
阅读(33)
推荐(0)
摘要:
let hd={ name:"后盾人" }; let User={ name:"ych", show(){ console.log(this.name); } } Object.setPrototypeOf(hd,User); hd.show();//后盾人
阅读全文
posted @ 2022-01-28 17:08
weakup
阅读(21)
推荐(0)
摘要:
<button class="red">red</button> <button></button> let arr=[1,3,4,34]; let res= arr.filter(item=>{ return item>30; }); console.log(res); let btns= doc
阅读全文
posted @ 2022-01-28 15:58
weakup
阅读(46)
推荐(0)
摘要:
let arr =[1,3,4,5,23]; console.log(Math.max.call(null,...arr)); let xj={ lessons:{js:92,node:83,java:86}, data:[92,83,86], }; console.log(Math.max.app
阅读全文
posted @ 2022-01-28 15:29
weakup
阅读(19)
推荐(0)
摘要:
let hd={data:[12,54,6,2,53]}; Object.setPrototypeOf(hd,{ max(data){ return data.sort((a,b)=>b-a)[0]; } }) console.log(hd.max(hd.data)); let xj={ lesso
阅读全文
posted @ 2022-01-28 15:06
weakup
阅读(30)
推荐(0)
摘要:
let a={url:"hdr"}; let b={name:"jack"}; Object.setPrototypeOf(a,b); //会检测自身和父亲 console.log("name" in a); //只检测自己 console.log(a.hasOwnProperty("name"))
阅读全文
posted @ 2022-01-28 14:53
weakup
阅读(31)
推荐(0)
摘要:
let a={}; let b={}; let c={}; Object.setPrototypeOf(b,c); Object.setPrototypeOf(a,b); console.log(b.isPrototypeOf(a));
阅读全文
posted @ 2022-01-28 14:45
weakup
阅读(38)
推荐(0)
摘要:
function A(){} function B(){} function C(){} let c=new C(); B.prototype=c; let b=new B(); A.prototype=b; let a=new A(); console.log(a instanceof A); c
阅读全文
posted @ 2022-01-28 14:39
weakup
阅读(36)
推荐(0)
摘要:
let a={}; let b={}; // a的父级是b Object.setPrototypeOf(a,b);
阅读全文
posted @ 2022-01-28 14:32
weakup
阅读(32)
推荐(0)