函数封装进阶
函数封装进阶
函数封装进阶
详情见 webstorm test1-四阶段-21.1.15-封装进阶
1 构造函数+原型+自执函数
2 传对象出去,1 中的构造函数 new 对象出来,放在函数内传递出来
3 2 创建的函数放在自执行函数里面隐藏,通过 window 全局对象暴露出去
* (暴露的是方法,可以传参数,把外部写的数据,传递到 new 的里面)
- *js 进阶:封装 –构造函数+原型+包裹函数+自执行函数+暴露包裹函数
1 |
|
1.jQuery.extend(object);为扩展 jQuery 类本身.为类添加新的方法。
2.jQuery.fn.extend(object);给 jQuery 对象添加方法。
jQuery.fn.extend = jQuery.prototype.extend
**>>给函数设置参数的默认值****。**
** – 调用时传的参会覆盖这的值。**
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!