函数中的this添加函数是加在对象上,而this.prototype是添加在原型上,通过prototype的指向来一级一级查找

prototype是构造函数访问原型对象,__proto__是对象实例访问原型对象

    Function.prototype.add=function(name,fn){
this.prototype[name]=fn;
return this;
}
var Methods=function(){
this.addObj = function () { console.log("my is add to obj") }
};
Methods.add('a', function () { console.log("a") }).add('b', function () { console.log("b")})
console.log(Methods)
console.log(Methods.prototype)
var che=new Methods();
che.addObj()//"my is add to obj"
che.a()//b

 console.log(che.constructor)
console.log(che.constructor == Methods)//true

 che.constructor指向构造函数 

最新文章

  1. Android DownloadProvider学习
  2. javascript opacity兼容性随笔
  3. 初识你---------Swift【下篇】
  4. C#基础-ref、out
  5. 在C#中利用Nuget包使用SQLite数据库和Linq to SQLite
  6. 关于Java中return和finally谁先执行.
  7. GWT环境搭建--eclipse
  8. Oracle core03_ACID
  9. MYSQL死锁
  10. Gradle 1.12 翻译——第十四章. 教程 - 杂七杂八
  11. webUI自动化测试框架---”pyswat“介绍
  12. python特征提取——pyAudioAnalysis工具包
  13. https 与 http
  14. springMVC源码分析--@ModelAttribute使用及运行原理
  15. css 四周边框角加粗效果
  16. Python基础:二、python介绍
  17. Python将是人工智能时代的最佳编程语言
  18. python之auto鼠标/键盘事件
  19. Python3.6.2在线安装pymysql模块
  20. 项目总结02:百度地图js 基本用法介绍

热门文章

  1. 《Python编程从0到1》笔记4——你分得清“索引和切片”吗?
  2. Mysql 表空间和 数据页空洞
  3. Python 入门之 内置模块 -- hashlib模块
  4. vue-router的query和params的区别
  5. 微信小程序与内嵌webview之间来回跳转的几点总结,以及二维码的使用
  6. asp.net运行原理及机制
  7. LOCATE()和FIND_IN_SET()
  8. 094、Swarm 中最重要的概念(Swarm01)
  9. vue elementui table组件内容换行
  10. python 中if __name__ = '__main__' 的作用