The Player Card
JavaScript
10 pts
The Player Card
Create an object player with these properties: name "Yonas", number 9, team "Red Sea FC" and goals 4.
Yonas scores again: add 1 to player.goals in your code (do not write 5). Then add a new property position with the value "striker". Print a sentence and the whole object. Expected output:
Yonas has 5 goals
{ name: "Yonas", number: 9, team: "Red Sea FC", goals: 5, position: "striker" }
Checklist
- Create
playerwith name, number, team and goals. - Add 1 to the goals in your code.
- Add the new property
position. - Print the sentence and the whole object.
🔑 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.
