Show the Student
JavaScript
10 pts
Show the Student
Display the object student in three ways:
- With a
for…inloop, print one line per property askey: value. - Create
jsonwithJSON.stringify(student)and print it. - Print the number of properties using
Object.keys(student).length, followed by the wordproperties.
Expected output:
name: Abel
age: 15
club: Robotics
{"name":"Abel","age":15,"club":"Robotics"}
3 properties
Checklist
- Print each property with a
for…inloop. - Create
jsonwithJSON.stringify. - Count the properties with
Object.keys. - Print all five lines.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
