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 what properties will be used in the Player Class.
Default Values
Note: This explanation will also be repeated later in the course.
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-
Alex Hort-Francis
17,074 Points1 Answer
-
Agata Zurek
Full Stack JavaScript Techdegree Graduate 26,419 Points1 Answer
-
Julianna Kahn
20,702 Points4 Answers
-
PLUS
Saud Tauqeer
Courses Plus Student 8,099 Points1 Answer
-
PLUS
Gonzalo Torres del Fierro
Courses Plus Student 16,751 Points1 Answer
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