let working = {
foo: function() {
console.log("working");
}
};
let notworking = {
foo() {
console.log("notworking");
}
}
new working.foo();
new notworking.foo();
and its output
Uncaught TypeError: notworking.foo is not a constructorplease explain why this particular function cannot be used as a constructor function.
Hint: based on this SO question where the explanation is provided.
No comments:
Post a Comment