Answers for "JS how to access a class propert"

0

JS how to access a class propert

function Penguin(name){

   this.name=name;

   this.numLegs=2;

}

var emperor = new Penguin("emperor");

console.log(emperor.name);
console.log(emperor.numLegs);
Posted by: Guest on October-28-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language