Why is JavaScript prototype property undefined on new objects?

Only constructor functions have prototypes. Since x is a constructor function, x has a prototype.

b is not a constructor function. Hence, it does not have a prototype.

If you want to get a reference to the function that constructed b (in this case, x), you can use

b.constructor

Leave a Comment