JavaScript · Exercise 1 of 5Next
Beginner
A pet object with a method
Fill in the pet object with three properties: name (a string), type (a string, like "cat") and age (a number).
Add a method describe() that returns text like Bruno is a 3-year-old dog, built from the object's own properties with this.
Show the result of pet.describe() in the #out paragraph.
What Check tests
pethas a stringname, a stringtypeand a numberagedescribe()returns the sentence in the right formatdescribe()uses the current values (throughthis)- The page shows the description
- No errors
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.