A Pet Object
Describe a pet.
A Pet Object is a free Javascript for Kids lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Javascript for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Adopt a Pet! 🐾
Time for a fun project! Let us build a pet using everything we learned about treasure chests (objects).
We will describe our pet, read its info, and even take care of it! 🐶🐱
Make the Pet Chest 🧰
First we build the object. Our pet has a name, type, and age!
let pet = {
name: 'Coco',
type: 'puppy',
age: 1
}
console.log(pet)Say Hello to Your Pet 👋
Let us read the name and greet our new friend!
let pet = { name: 'Coco', type: 'puppy', age: 1 }
console.log('Hello, ' + pet.name + '!')Describe Your Pet 📝
Let us put all the treasures into one fun sentence!
let pet = { name: 'Coco', type: 'puppy', age: 1 }
console.log(pet.name + ' is a ' + pet.type)How Old? 🎂
Let us tell everyone how old our pet is.
let pet = { name: 'Coco', age: 1 }
console.log(pet.name + ' is ' + pet.age + ' years old')Add a Happiness Treasure 😊
Let us add a NEW treasure to track how happy our pet is!
let pet = { name: 'Coco' }
pet.happiness = 5
console.log(pet.happiness)Feed the Pet 🍖
Feeding makes our pet happier! Let us add 1 to happiness.
let pet = { name: 'Coco', happiness: 5 }
pet.happiness = pet.happiness + 1
console.log(pet.happiness)Pet's Birthday! 🎉
It is your pet's birthday! Make it one year older.
let pet = { name: 'Coco', age: 1 }
pet.age = pet.age + 1
console.log(pet.name + ' is now ' + pet.age)Give Your Pet a Color 🌈
Let us add a color treasure so we know what our pet looks like!
let pet = { name: 'Coco' }
pet.color = 'golden'
console.log(pet.name + ' is ' + pet.color)Is Your Pet Hungry? 🍽️
Let us add a true/false treasure to check if our pet is hungry!
let pet = { name: 'Coco', hungry: true }
console.log('Hungry? ' + pet.hungry)
pet.hungry = false
console.log('Hungry now? ' + pet.hungry)The Full Pet Card 🪪
Let us show off our complete pet with ALL its treasures! Change the values and make YOUR own pet. 🌟
let pet = {
name: 'Coco',
type: 'puppy',
age: 2,
color: 'golden'
}
console.log(pet.name + ' the ' + pet.type)
console.log('Age: ' + pet.age)
console.log('Color: ' + pet.color)Quick Check ✅
One last brain teaser about your pet object! 🧠
Pet Project Recap 🎉
Amazing! 🐾 You built a whole pet using objects!
- Created a chest with name, type, age
- Read treasures to describe your pet
- Changed and added treasures to care for it
You are an object expert now! 🏆 Go make a pet for a friend! 💛
Frequently asked questions
Is the “A Pet Object” lesson free?
Yes — the full text of “A Pet Object” is free to read here on the web, and the Javascript for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Javascript for Kids course, upgrade to CoddyKit PRO.
What will I learn in “A Pet Object”?
Describe a pet. You practise Javascript for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Javascript for Kids?
No prior experience is required. Javascript for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “A Pet Object” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Javascript for Kids lesson?
Yes. Every Javascript for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.