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
    
      
  Practice methods learned in the previous lessons in a file naming application
Resources
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
                      Now that you're more familiar
with string methods,
                      0:00
                    
                    
                      let's put them into practice
with a challenge.
                      0:02
                    
                    
                      File names often have their
own rules around formatting.
                      0:05
                    
                    
                      It's typical to not allow spaces or
special characters in file names.
                      0:09
                    
                    
                      In this challenge, using methods you've
learned in this workshop you will create
                      0:15
                    
                    
                      file name strings that follow three rules.
                      0:20
                    
                    
                      Open a workspace or download the project
files to complete this challenge.
                      0:23
                    
                    
                      In the project files,
                      0:28
                    
                    
                      we use our same index.html as a front
end with a prompt that takes a first and
                      0:30
                    
                    
                      last name and
provide the file name using both values.
                      0:35
                    
                    
                      Behind the scenes in our AppJS,
                      0:41
                    
                    
                      you'll complete a function that is called
when input is entered by the user.
                      0:42
                    
                    
                      Using string methods remove any
spaces from the given name then put
                      0:47
                    
                    
                      an underscore in the place of space
between the first and last name.
                      0:52
                    
                    
                      Next, check each letter in the name and
make sure it's lowercase.
                      0:57
                    
                    
                      Once you've done this,
                      1:02
                    
                    
                      the function will add a filename extension
.jpg to the end of the string and
                      1:04
                    
                    
                      print a message to the screen containing
the file name in the correct format.
                      1:08
                    
                    
                      For example, if I type my name,
Reggie, capital R space,
                      1:14
                    
                    
                      capital W, Williams and
click the OK button.
                      1:21
                    
                    
                      The file name returned is
reggie_Williams.jpg, all lowercase.
                      1:27
                    
                    
                      Try breaking this down step by step and
                      1:34
                    
                    
                      using pseudocode to solve this problem
before jumping into the text editor.
                      1:36
                    
                    
                      In the next video,
I'll show you my solution.
                      1:41
                    
              
        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