摘要: 通常我们用exports 或module.exports 来导出一个文件中的接口和字段,用require来引用导出的对象.那么这个exports 和 module.exports到底有啥关联呢? 1.新建app.js 然后写代码 :console.log({} instanceof Object) 阅读全文
posted @ 2016-10-20 16:14 JonasYu 阅读(1734) 评论(1) 推荐(0) 编辑
摘要: function test(){ this.a = 1; this.func = function(){ // var a = 3;下面的this 取的是上面的1,这个不影响 return this.a + 2; }} test.prototype.say = function(){ console 阅读全文
posted @ 2016-10-20 15:22 JonasYu 阅读(1004) 评论(0) 推荐(0) 编辑