node与windows下的this
来源:互联网 发布:苹果软件发布 编辑:程序博客网 时间:2024/06/17 15:08
windows环境下与node环境下的this比较:
(1)windows
a.var pet ={ word:'....', speak:function(){ console.log(this.word); console.log(this === pet); }}pet.speak();结果:... trueb.function pet(word){ this.word = word; console.log(this === window);}pet('....');结果:truec.function pet(word){ this.word = word; this.speak = function(){ console.log(this); }}var p = new pet('...');p.speak();结果:petspeak: ()word: "..."__proto__: Object
(2)node
a.var pet ={ word:'....', speak:function(){ console.log(this.word); console.log(this === pet); }}pet.speak();结果:... trueb.function pet(word){ this.word = word; console.log(this === window);}pet('....');结果:error修改:function pet(word){ this.word = word; console.log(this === global);}pet('....');c.function pet(word){ this.word = word; this.speak = function(){ console.log(this);}}var p = new pet('...');p.speak();结果:pet { word: '...', speak: [Function] }
阅读全文
1 0
- node与windows下的this
- Windows下Node.js与npm的安装与配置
- Windows下Node.js与npm的安装与配置
- Windows系统下node.js的安装与配置
- Windows下Node.js的安装与使用
- Windows环境下Node.js的安装与测试
- Windows下Node.js的安装与配置
- Windows平台下的Node.js安装
- Node.js在windows下的安装
- 了解windows下Node.js的调试
- node.js在windows下的安装与配置(附sublime-text的配置)
- windows下node升级
- Windows 下 Node JS 环境搭建 与 NodeJS简单了解
- Node.js Electron windows下安装与打包成 exe
- node.js开发:在windows环境下安装node与环境配置
- Windows 下安装node-canvas
- Windows下运行node app
- Windows下配置Node.js
- 如何溜溜地使用pandas操作数据(一)
- iOS-给数组去重的几个方法
- Java中return在Try-Catch中的执行
- HashMap的实现原理
- IDEA自动重置LanguageLevel和JavaCompiler的问题 (internal java compiler error)
- node与windows下的this
- Java笔记--02
- 拓展KMP
- Java 基本数据类型
- cocos2d-x: android编译和调试
- Flume NG 基本架构及原理
- 【JAVA 提高班之七】多线程互斥和协作
- unity 写代码过程中减少gc的方法
- 洛谷p1198最大数