Level Navigation: 0 | Current Level: 1 | 2 | 3 | 4 | 5 |
Set up your project environment and complete the initial “Look and Guess” activity to understand basic POJO structure.
In the terminal:
cd path/to/your/projects
mkdir pojo-practice
cd pojo-practice
git init
touch script.js
The file script.js
is the only file you will need for this lesson. You will copy and paste the starter code from the lessons into this file, as you progress in the level. By the end of the Lesson, you will have all the starter code pasted in. You will also write your code in this file. Note: This file will get long!
pojopractice
script.js
:const pet = {
"name": "Buddy",
"species": "Dog",
"age": 5
};
console.log(pet.name);
console.log(pet.species);
console.log(pet.age);
pet.age = 6;
console.log(pet.age);
// TODO: What do you think each console.log will print?
// I guess it will print: ...
node script.js
Expected output:
Buddy Dog 5 6
Explanation:
console.log(pet.name)
prints: Buddy
console.log(pet.species)
prints: Dog
console.log(pet.age)
prints: 5
(original value)pet.age = 6
updates the age property to 6console.log(pet.age)
prints: 6
(updated value)git add script.js
git commit -m "Step 1 completed - Look and Guess"
git push
You practiced:
Level Navigation: 0 | Current Level: 1 | 2 | 3 | 4 | 5 |