This question already has answers here:
Closed 3 years ago.
In the following code, I am having trouble figuring out how to log (in the console) the name
and numLegs
properties of Penguin
(i.e., "emperor" and 2), without changing the inside of the function?
function Penguin(name) {
this.name = name;
this.numLegs = 2;
}
var emperor = new Penguin("emperor");
How can I do that?