Level Navigation: 0 | 1 | 2 | Current Level: 3 | 4 | 5 |
Practice reading object properties and updating them with new values through guided exercises.
script.js
.const sprite = {
"name": "Hero",
"x": 100,
"y": 200
};
console.log(sprite.x);
sprite.x = 150;
console.log(sprite.x);
sprite.y = 250;
console.log(sprite.y);
// TODO: Write your guesses for each console.log as comments.
Run the file:
node script.js
git add script.js
git commit -m "Step 3 Look and Guess completed"
git push
const book = {
"title": "JavaScript for Beginners",
"author": "Jane Doe",
"pages": 250
};
// TODO: Print the number of pages.
// TODO: Update pages to 300.
// TODO: Print pages again to confirm update.
const pet = {
"name": "Buddy",
"species": "Dog",
"age": 5
};
// TODO: Print name and age.
// TODO: Change age to 6.
// TODO: Print age again.
const sprite = {
"name": "Hero",
"x": 100,
"y": 200
};
// TODO: Print x and y values.
// TODO: Update x to 120 and y to 220.
// TODO: Print x and y again.
git add script.js
git commit -m "Step 3 completed - Read and Update Exercises"
git push
You practiced:
Level Navigation: 0 | 1 | 2 | Current Level: 3 | 4 | 5 |