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 unusedTokens, activePlayer, and activeToken getter methods.
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
Open up the player.js file.
0:00
We'll start with unused tokens.
0:01
There's a handy JavaScript
array method called filter,
0:03
that I've used to write a quick and
succinct getter method for unused tokens.
0:07
The filter method is called on
an array and it's passed the test.
0:11
The method returns in
the form of another array,
0:15
any elements of the original array
that pass the provided test.
0:18
So you've called the filter method
on the player's token's property,
0:23
which is holding an array of every
token object belonging to the player.
0:26
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