The full text of this chapter, to read or revisit. To practise, do the exercises.
Exercise 1 — Codémon Journey: Step 1
You just discovered a wild Codémon named Zap!
Create its profile:
1.
codemonName
- Use
const
for the name "Zap" (it never changes)
2.
level
- The level: 5
3.
hp
- The health points: 50
4.
owner
- The owner:
null
(it's a wild Codémon)
5.
isHealthy
- A boolean: true
Then display all variables with
console.log()
!
Starter code
// Step 1: Create Zap's profile
Exercise 2 — Codémon Journey: Step 2
You caught Zap and trained hard! Time to update:
1. Change
owner
to your name
2. Add 3 to the
level
(Zap is now level 8!)
3. Display the updated
owner
and
level
with
console.log()
Starter code
const codemonName = "Zap";
let level = 5;
let hp = 50;
let owner = null;
let isHealthy = true;
Exercise 3 — Codémon Journey: Step 3
Battle time! You face a wild Pyrochu but lose the fight 😢
1. After the battle, set
isHealthy
to
false
2. Use
typeof
to check the type of ALL five variables and display them with
console.log()
Starter code
const codemonName = "Zap";
let level = 8;
let hp = 50;
let owner = "Pierre";
let isHealthy = true;