摘要:
div { color: red; font-size: 12px; } div { color: pink; } <div>长江后浪推前浪,前浪死在沙滩上</div> 阅读全文
摘要:
function load(src,resolve,reject){ let image=new Image(); image.src=src; image.onload=resolve; image.onerror=reject; } load( "../images/1.jpg", ()=>{ 阅读全文
摘要:
let module=(function(){ const moduleList={}; function define(name,modules,action){ modules.map((m,i)=>{ modules[i]=moduleList[m]; }) moduleList[name]= 阅读全文
摘要:
function User(){} function Admin(){} Admin.prototype=Object.create(User.prototype); let hd=new Admin(); console.log(hd instanceof Admin); console.log( 阅读全文
摘要:
原生JS(es5)中的静态方法 //原生JS中的静态方法 function Person(name, age) { this.name = name; this.age = age; this.run = function () { console.log(`${this.name} is ${th 阅读全文
摘要:
class User{ // 属性 sitr='hdsj'; constructor(name){ this.name=name; } getName(){ return this.name; } changeSite(value){ this.site=value; } show(){ retur 阅读全文
摘要:
//使用原型工厂封装继承 function extend(sub,sup){ sub.prototype=Object.create(sup.prototype); Object.defineProperty(sub.prototype,"constructor",{ value:sub, enum 阅读全文
摘要:
//使用原型工厂封装继承 function extend(sub,sup){ sub.prototype=Object.create(sup.prototype); Object.defineProperty(sub.prototype,"constructor",{ value:sub, enum 阅读全文
摘要:
function User(name,age){ this.name=name; this.age=age; } User.prototype.show=function(){ console.log(this.name,this.age); } function Admin(...args){ / 阅读全文
摘要:
function Admin(){ Admin.prototype.showAdmin=function(){ return "admin"; } } function Enterprise(){ Enterprise.prototype.showEnterprise=function(){ ret 阅读全文