Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Object-Oriented JavaScript: Challenge!
You have completed Object-Oriented JavaScript: Challenge!
Preview
See the solution for the playToken() method.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
I'm really excited to walk through
the playToken method with you, and
0:00
then load up a demo of what we've done so
far in the browser.
0:01
Let's get started.
0:04
Navigate to the game.js file.
0:06
The playToken method can be written
immediately below the handleKeyDown
0:08
method.
0:12
So the first thing I did in this
method was store some things
0:13
we'll be using throughout it in variables.
0:16
You don't have to do this, of course.
0:19
But in this case,
it made my code a lot easier to read and
0:20
a lot easier to write, too.
0:23
First, I declared
a variable called spaces.
0:25
This was set to this.board.spaces,
meaning the spaces variable now holds
0:28
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