摘要: Javascript 对象有 Array对象用于在变量中存储多个值。 Array对象属性: copyWithin() 从数组的指定位置拷贝元素到数组的另一个指定位置中。 用法:array.copyWithin(traget,start,end) Exp: 阅读全文
posted @ 2018-10-16 21:11 johnhery 阅读(886) 评论(0) 推荐(0) 编辑
摘要: 1 2 3 4 5 6 jQuery 扩展 extend 回顾 7 8 9 10 11 12 1 var a = $.extend(false,{b:'c'},{a:{name:'john'},c:'f'}); 2 3 console.log(a); 4 5 var a = { }; 6 var b = { c:{age... 阅读全文
posted @ 2018-10-16 19:16 johnhery 阅读(95) 评论(0) 推荐(0) 编辑
摘要: || 阅读全文
posted @ 2018-10-16 19:11 johnhery 阅读(404) 评论(0) 推荐(0) 编辑
摘要: 1 2 3 4 5 6 列出所有的属性键 7 8 9 10 11 1 function getAllpropertyNames(obj){ 2 var result=[]; 3 while(obj){ 4 Array.prototype.push.apply(result,Object.getOwnPropertyNa... 阅读全文
posted @ 2018-10-16 19:08 johnhery 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 自动分号插入 ASI 1 // call 与 apply 2 // 构造形状类 3 function Sharp(name){ 4 this.name = name 5 } 6 Sharp.prototype.area = function(l,w) { 7 ... 阅读全文
posted @ 2018-10-16 19:06 johnhery 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 对象间的原型关系02 var proto = { description:function(){ return 'My name is '+ this.fullname +', I\'m a '+this.sex } } var john = { __proto__:proto, fullname : 'johnhery', ... 阅读全文
posted @ 2018-10-16 19:05 johnhery 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 1 2 3 4 5 6 JS中的call()和apply()方法 7 8 9 JS中的call()和apply()方法 10 11 call 方法定义: 12 13 语法:call(this Obj[,arg1[,arg2[,[argN]]]]) 14 定义:调用一个对象的一个方法,以另一个对象替换当前对象。 15 说明: 16... 阅读全文
posted @ 2018-10-16 19:01 johnhery 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 1 2 3 4 5 6 jQuery 插件 7 8 9 10 11 1 12 2 13 3 14 15 16 4 17 5 18 6 19 20 21 1 $(function(){ 2 $.fn.extend({ 3 changecolor:function(){ 4 re... 阅读全文
posted @ 2018-10-16 19:00 johnhery 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 1 2 3 4 5 6 jQuery 构造函数 7 8 9 10 11 1 function AAA(){} 2 3 AAA.prototype.name='john'; 4 AAA.prototype.say=function(){ 5 console.log('hello'); 6 } 7 8 var a1 = n... 阅读全文
posted @ 2018-10-16 18:59 johnhery 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 合并两个数组,修改第一个参数的内容 定义和用法 $.merge() 函数用于合并两个数组内容到第一个数组。 阅读全文
posted @ 2018-10-16 18:56 johnhery 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 插入排序,每次排一个数组项,以此方式构建最后的排序数组。假定第一项已经排序了,接着,他和第二项进行比较,第二项是应该待在原位还是插到第一项之前呢?这样前两项已正确排序,接着和第三项比较(他是该插入到第一、第二、还是第三的位置呢?)以此类推。 阅读全文
posted @ 2018-10-16 18:46 johnhery 阅读(172) 评论(0) 推荐(0) 编辑