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 property on the fly 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
Outside of the object literal you
can add a new property to it by
0:01
accessing the new property with dot or
bracket notation and giving it a value.
0:04
This process is a lot like
creating a new variable.
0:09
myString.characters indicates that now
there is going to be a new property on
0:13
myString called characters.
0:17
Then we assign it a value, just like
you do when you declare a variable.
0:19
Now, strings, like arrays,
come with a property called length.
0:24
On a string, the length property
returns the number of characters.
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