Javascript的super关键字,当我在Chrome,Babel,TypeScript上运行代码时,我得到了不同的结果.
我的问题是哪个结果是正确的?规范的哪一部分定义了这种行为?
以下代码:
class Point {
getX() {
console.log(this.x); // C
}
}
class ColorPoint extends Point {
constructor() {
super();
this.x = 2;
super.x = 3;
console.log(this.x) // A
console.log(super.x) // B
}
m() {
this.getX()
}
}
const cp = new ColorPoint();
cp.m();
Run Code Online (Sandbox Code Playgroud)
结果:
链接:
我把这个取自
\n\n\n\nvar AppDispatcher = require(\'../dispatcher/AppDispatcher\');\nvar EventEmitter = require(\'events\').EventEmitter;\nvar TodoConstants = require(\'../constants/TodoConstants\');\nvar assign = require(\'object-assign\');\n\nvar CHANGE_EVENT = \'change\';\n\nvar _todos = {}; // collection of todo items\n\n/**\n * Create a TODO item.\n * @param {string} text The content of the TODO\n */\nfunction create(text) {\n // Using the current timestamp in place of a real id.\n var id = Date.now();\n _todos[id] = {\n id: id,\n complete: false,\n text: text\n };\n}\n\n/**\n * Delete a TODO item.\n * @param {string} id\n */\nfunction …Run Code Online (Sandbox Code Playgroud) 我正在关注官方文档:https : //hyperledger-fabric.readthedocs.io/en/latest/build_network.html
我正在建立我的第一个网络。但是当实例化节点版本链码时,由于我的机器在代理后面工作,因此NPM总是向我抛出网络异常。
我已经尝试在package.json或脚本中设置代理,但是它不起作用。
如何避免这种情况?
例如,如果我执行:
./byfn.sh -c mychannel -l go up
Run Code Online (Sandbox Code Playgroud)
它运作良好。
但是,如果我执行:
./byfn.sh -c mychannel -l node up
Run Code Online (Sandbox Code Playgroud)
它将引发异常,因为容器没有Internet访问权限来下载节点模块,否则...