Why is it possible to do Object.create
directly on an object:
const greet = {
name: null
}
let s = Object.create(greet);
But you cannot do that directly on a function, and must add in the .prototype
of it.
function greet(name) {
this.name = name;
}
let s = Object.create(greet.prototype);
Why is one allowed but the other is not?