06 2017 档案
摘要:闭包(closure)是Javascript语言的一个难点,也是它的特色,很多高级应用都要依靠闭包实现。 要学习闭包最先需要学习js的变量作用域(第一节教程已经讲过),变量的作用域无非就是两种:全局变量和局部变量。 js 语言的特殊之处,就在于函数内部可以直接读取全局变量。另一方面,在函数外部自然无
阅读全文
摘要:<script type="text/javascript"> function person(name, age) { this._name = name; this._age = age; var _self = this; this.say = function() { console.log
阅读全文
摘要:使用JSON 来定义一个对象: <script type="text/javascript">var xiaoming = { name : 'xiaoming', age : 18, say : function(){ console.log('my name is '+this.name); }
阅读全文

浙公网安备 33010602011771号