随笔分类 -  JavaScript

摘要:方式一:原型链继承(prototype模式) function Animal(){ this.species = "动物";}function Cat(name,color){ this.name = name; this.color = color;}Cat.prototype = new Animal();//核心Cat.prototype.constructor = Ca... 阅读全文
posted @ 2017-05-30 21:09 enginex 阅读(149) 评论(0) 推荐(0)
摘要:一、冒泡排序 function bubbleSort(arr){ for(var i=1;iarr[j+1]){//如果前一个数大于后一个,则交换二者的值 arr[j+1]=[arr[j],arr[j]=arr[j+1]][0]; } ... 阅读全文
posted @ 2017-05-26 15:22 enginex 阅读(227) 评论(0) 推荐(0)
摘要:一、JS中的数据类型5种基本数据类型:Number、String、Boolean、Null、Undefined1种复杂数据类型:Object(Array、Function、Reg、Date...)1.typeof语法:typeof num;结果:Number/String/Boolean/Undefined/Function正常、null/Array/Reg/Date-->Object2.inst... 阅读全文
posted @ 2017-05-06 09:44 enginex 阅读(150) 评论(0) 推荐(0)