function Dog(name) {
this.name = name;
}
Dog.prototype.numLegs = 4;
let beagle = new Dog("Snoopy");
let ownProps = [];
let prototypeProps = [];
// Only change code below this line
for(let x in beagle){
if(beagle.hasOwnProperty(x)){
ownProps.push(x)
}else{
prototypeProps.push(x)
}
}
console.log(ownProps,"and",prototypeProps)
//result
//[ 'name' ] and [ 'numLegs' ]
No comments:
Post a Comment