Bummer! You have been redirected as the page you requested could not be found.
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 Practice Object Basics in JavaScript!
You have completed Practice Object Basics in JavaScript!
Preview
Solution video for adding a method code challenge.
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
The goal was to add a method to
the object literal called count words,
0:00
that returned the number of
words in the string property.
0:02
Adding a method to an object literal
is a lot like adding a property.
0:05
It has the key,
which is the name of the method, and
0:08
a value, which is the actual method.
0:10
So let's add our key.
0:13
Then our method declaration.
0:17
So how do we get the number
of words in a phrase?
0:23
Strings in JavaScript have a lot of
neat methods you can use on them.
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