Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- Preparing to Build the Classes 0:34
- Practice Brainstorming Properties
- Player Properties Solution 2:57
- Token Properties Brainstorming
- Token Properties Solution 2:33
- Build the createTokens() Method
- createTokens() Method Solution 3:06
- Board and Space Class Constructor Methods
- Board and Space Class Constructor Methods Solution 3:58
- Build the createSpaces() Method
- createSpaces() Method Solution 2:46
- Game Class Constructor Method
- Game Class Constructor Method Solution 2:45
- Reviewing Constructor Methods and Generating Objects 5 questions
Well done!
You have completed Object-Oriented JavaScript: Challenge!

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
See the solution for the Game class constructor method.
Default Values
Default values are a way to initialize parameters with a specific value, even if no value or undefined is passed.
If an argument is passed for that parameter, the parameter will be initialized with the passed value.
If an argument is not passed, the parameter will be initialized with the default value.
In the following example, the company
parameter has a default value of "Treehouse". If no third argument is sent when the function is called, the parameter company will still be available in the function, with a value of "Treehouse".
const name = 'Ashley';
const job = 'teacher';
printEmployee(name, job);
printEmployee(name, job, company = 'Treehouse') {
//function code here
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Tetsuya Yokoyama
11,286 Points2 Answers
-
issa Mohamed
7,373 Points1 Answer
-
Ermin Bicakcic
5,144 Points1 Answer
-
Dwayne Bynum
10,408 Points1 Answer
-
Zijun Liao
13,409 Points1 Answer
-
raul montes
134 Points2 Answers
-
raul montes
134 Points2 Answers
-
Leonardo Motta
11,284 Points1 Answer
-
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points5 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up