摘要: 对应indexOf这个方法,在日常开发中比较常见的应该是String.prototype.indexOf()方法,Array.prototype.indexOf()方法和其有很大的相似性,本文不想去描述其的基本用法,而是去探究在使用中需要考虑的一些问题。一、性能在数组元素少的情况下,我们虽然只是跳过... 阅读全文
posted @ 2014-11-04 23:19 Benjamin-zuo 阅读(3675) 评论(0) 推荐(0) 编辑
摘要: 一、常见继承方式我们日常开发中常见的继承方式主要有: 1、默认模式:Child.prototype = new Parent();2、借用构造函数:function Child(a, b, c, d) { Parent.apply(this, arguments);}3、借用和设置原型:functi... 阅读全文
posted @ 2014-11-04 22:20 Benjamin-zuo 阅读(4074) 评论(2) 推荐(1) 编辑