摘要: var array =[]; Array.prototype.push = function (){ for (var i=0; i< arguments.length; i++){ this[this.length]= arguments[i]; } return this.length; } 阅读全文
posted @ 2019-08-13 20:46 呼吸之间 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 1,2 结果识别 1和2 然后返回后面的值 阅读全文
posted @ 2019-08-10 21:25 呼吸之间 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-08-10 11:29 呼吸之间 阅读(153) 评论(0) 推荐(0) 编辑
摘要: var obj ={ name:'suan', sex :'male', age:150, height:185, characeter:true, _proto_:{ lastName:'susan', _proto:{ lastSex:'male' } } } for(var key in ob 阅读全文
posted @ 2019-08-06 19:36 呼吸之间 阅读(398) 评论(0) 推荐(0) 编辑
摘要: for in 循环会返回 原型 以及原型链上面的属性,不会打印系统自带的属性 var obj ={ name:'suan', sex :'male', age:150, height:185, characeter:true } for(var key in obj){ // console.log 阅读全文
posted @ 2019-08-06 19:14 呼吸之间 阅读(529) 评论(0) 推荐(0) 编辑
摘要: obj.name >obj[name] 这两种调用方式一样,使用obj.name内部转换成 obj['name'], 使用obj['name']更快。 obj['name'] 里面必须是字符串 var jack = { wife1: {name: 'susan'}, wife2 :{name: 'h 阅读全文
posted @ 2019-08-06 18:17 呼吸之间 阅读(3294) 评论(0) 推荐(0) 编辑
摘要: var jack = { somke : function (){ console.log('I was in the somkeing...cool..'); return this; }, drink : function(){ console.log('I want cocaCola'); r 阅读全文
posted @ 2019-08-06 17:42 呼吸之间 阅读(294) 评论(0) 推荐(0) 编辑
摘要: 作用 :改变this指向。 区别: 后面传的参数形式不同。 function Sit (c,sitColor){ this.c = c; this.sitColor = sitColor; } function Model(height,width,len){ this.height = heigh 阅读全文
posted @ 2019-08-06 11:12 呼吸之间 阅读(165) 评论(0) 推荐(0) 编辑
摘要: //圣杯模式 function inherit(Target,Origin){ function F(){} F.prototype = Origin.prototype; Target.prototype = new F(); Target.prototype.constuctor = Targe 阅读全文
posted @ 2019-08-06 10:54 呼吸之间 阅读(478) 评论(0) 推荐(0) 编辑