摘要:
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)
推荐(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)
推荐(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)
推荐(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)
推荐(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)
推荐(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)
推荐(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)
推荐(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)
推荐(0)
摘要:
let a={}; let b={}; // a的父级是b Object.setPrototypeOf(a,b); 阅读全文
posted @ 2022-01-28 14:32
weakup
阅读(32)
评论(0)
推荐(0)
摘要:
function User(name){ this.name=name; } function createByObject(obj,...args){ const constructor= Object.getPrototypeOf(obj).constructor; return new con 阅读全文
posted @ 2022-01-28 14:25
weakup
阅读(35)
评论(0)
推荐(0)
摘要:
function User(name){ this.name=name; } //对应左边的 // 此方法是挂上show // User.prototype.show=function(){ // console.log(this.name); // } //对应右边的 //此方法是是重新创建了一个 阅读全文
posted @ 2022-01-28 14:12
weakup
阅读(34)
评论(0)
推荐(0)
摘要:
let hd={name:"hd"}; let parent={ name:"parent", show(){ console.log("parent method:"+this.name) } } Object.setPrototypeOf(hd,parent); hd.show(); paren 阅读全文
posted @ 2022-01-28 13:59
weakup
阅读(25)
评论(0)
推荐(0)
浙公网安备 33010602011771号