* fix: restructure certifications guide articles * fix: added 3 dashes line before prob expl * fix: added 3 dashes line before hints * fix: added 3 dashes line before solutions
780 B
780 B
title
title |
---|
Understand Own Properties |
Understand Own Properties
Problem Explanation
In the example code given you will see a new array ownProps[]
intialised followed by a for...in
statement to loop through the properties of duck
and then use a push()
statement to fill in the new array. The same method must be followed for the canary
object.
Simply replace the duck
object in the 'for...in' statement with the canary
object to pass all test cases.
Solutions
Solution 1 (Click to Show/Hide)
let canary = new Bird("Tweety");
let ownProps = [];
// Add your code below this line
for (let property in canary) {
if (canary.hasOwnProperty(property)) {
ownProps.push(property);
}
}