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 String Manipulation with JavaScript !
You have completed String Manipulation with JavaScript !
Preview
Solve the previous challenge using string manipulation 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
How'd it go?
0:00
I'll share one possible solution for
the challenge.
0:02
But keep in mind, there are many
methods and potential solutions.
0:05
If you didn't get it,
I'll give you a hint.
0:10
If you did, here's a chance to
see if we have the same solution.
0:13
First, trim down the white
space around the string.
0:19
You'll need to replace the space
between the names with an underscore.
0:23
Make sure all of
the characters are lowercase.
0:28
Now, you can pause here and
give it a try, or follow along.
0:33
First, to remove the white spaces,
0:39
I'll set the string equal to
itself with the trim function.
0:42
This will clear up any unintended
whitespace that wouldn't be allowed in our
0:50
file name.
0:54
Now it's time to replace the underscore.
0:57
I'll write,
another statement that sets the string
1:00
equal to itself; name equals
name with the replace method.
1:04
Inside the method, we'll type
the character that we're searching for;
1:10
a space followed by a comma and then
the value we'd like to replace it with,
1:15
an underscore, Now I'll save my AppJS.
1:20
Refreshing the browser, and type a name.
1:30
One thing's missing.
1:39
We'll go back and run toLowercase,
1:43
On the name variable, save again.
1:51
Now when we type our name,
We get the desired output.
1:58
katherine_johnson.jpg in all lowercase letters.
2:06
Great job getting more
familiar with string methods.
2:12
As always, make sure to keep practicing
what you've learned in your code.
2:15
Happy learning.
2:20
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