随笔分类 -  javascript进阶

摘要:Es6 写法 `ddddfdfdf dfdfdf ` 阅读全文
posted @ 2017-09-03 12:16 小小高 阅读(708) 评论(0) 推荐(0) 编辑
摘要:1.当function里嵌套function时,内部的function可以访问外部function里的变量。 2. 外部变量(环境变量?), 包括: 2.1 全局变量,包括DOM。 2.2 外部函数的变量或函数。 如果一个函数访问了它的外部变量,那么它就是一个闭包。 从技术上来讲,在JS中,每个fu 阅读全文
posted @ 2017-09-01 18:09 小小高 阅读(230) 评论(0) 推荐(0) 编辑
摘要://对象冒充实现继承 function Person() { this.speak = function () { alert("我是人类"); }; } function Chinese() { Person.call(this); } var p = new Chines... 阅读全文
posted @ 2017-06-06 13:29 小小高 阅读(173) 评论(0) 推荐(0) 编辑
摘要:function Person() { } Person.prototype.dance = function () { } function Ninjia() { } Ninjia.prototype = new Person(); var ninjia = new Ninjia(); 阅读全文
posted @ 2017-03-27 15:13 小小高 阅读(234) 评论(0) 推荐(0) 编辑
摘要:点我 var button={ clicked:false, click:function(){ debugger; this.clicked=true; console.assert(!(button.clicked),"The button has been clicked"); } } var elem... 阅读全文
posted @ 2017-03-27 13:48 小小高 阅读(195) 评论(0) 推荐(0) 编辑
摘要:function addMethod(object,name,fn){ var old=object[name]; object[name]=function(){ if(fn.length==arguments.length) return fn.apply(this,arguments); else if(typeo... 阅读全文
posted @ 2017-03-20 09:54 小小高 阅读(115) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示