TypeError: 'MyClass.MyFunction is not a function' error message in ES6 / Node 4
TypeError: 'MyClass.MyFunction is not a function' error message in ES6 / Node 4
我遇到了一个错误,我可以在 node.js 4.0 应用程序中使用以下代码复制该错误:
"use strict";
var Immutable = require("immutable");
class AspectType {
constructor(htmlLabel) { this.hhtmlLabel = htmlLabel; }
htmlLabel() { return this.hhtmlLabel; }
}
var AspectTypes = Immutable.OrderedMap()
.set("C",new AspectType("xxx"))
.set("D",new AspectType("yyy"))
.set("E",new AspectType("zzz"));
for (var retr in AspectTypes.values()) {
console.log(retr.htmlLabel());
}
我收到以下错误消息,为什么?
TypeError: retr.htmlLabel is not a function
at Object.<anonymous> (...\testt.js:17:22)
噗……
for (var retr of AspectTypes.values()) {
不是
for (var retr in AspectTypes.values()) {
我遇到了一个错误,我可以在 node.js 4.0 应用程序中使用以下代码复制该错误:
"use strict";
var Immutable = require("immutable");
class AspectType {
constructor(htmlLabel) { this.hhtmlLabel = htmlLabel; }
htmlLabel() { return this.hhtmlLabel; }
}
var AspectTypes = Immutable.OrderedMap()
.set("C",new AspectType("xxx"))
.set("D",new AspectType("yyy"))
.set("E",new AspectType("zzz"));
for (var retr in AspectTypes.values()) {
console.log(retr.htmlLabel());
}
我收到以下错误消息,为什么?
TypeError: retr.htmlLabel is not a function
at Object.<anonymous> (...\testt.js:17:22)
噗……
for (var retr of AspectTypes.values()) {
不是
for (var retr in AspectTypes.values()) {