I have the following code greatly abbreviated:
class Animal {
speak() {}
}
Animal.prototype.speaklouder = function() {};
for (const key in new Animal()) {
console.log("key", key);
}
Run codeHide resultThis gives in node 6.11.0,
key speaklouder
Why? I thought class syntax is just sugar? I expect the function will also be listed as an attribute.
user2311517
source
share