I need to discover the function 'foo' on class Something and it doesn't work. Is this because I am missing a subtlety of using class syntax or because of babel or something else? I would prefer to use 'class' wherever I can but the discovery is more important for me.
Any geniuses our there know this one?
class Something {
constructor() {
}
foo() {
console.log("foo");
}
}
var something = {
foo : function() {
console.log("foo");
}
}
var result = Object.getOwnPropertyNames(new Something()).join(", ");
console.log("new Something() = %s", result);
result = Object.getOwnPropertyNames(Something.__proto__).join(", ");
console.log("Something.__proto__ = %s", result);
result = Object.getOwnPropertyNames(something).join(", ");
console.log("var something = %s", result);
produces:
new Something() =
Something.__proto__ = length, name, arguments, caller, constructor, bind, call, apply, toString
var something = foo