On day 1 of the prework, you learned how to store information in variables. Today, you will learn about another way to store information; more specifically, how to use Functions to create Return Values. In programming, we often use functions, so this is an important concept to get familiar with!
When you are all done with the lessons, exercises, and questions for today, you will once again use git to save your work, and then put it in the cloud on GitHub.
Using your terminal, open the local copy of the repository that you created during setup. To do this, you will need to use the terminal command cd
to change into the directory that holds the repository. Once you are in the correct directory, use the terminal command atom .
to open the prework repository. If you are having trouble with this, see the day_1
instructions.
-
Read page 88, and pages 90 through 94 from the JAVASCRIPT & JQUERY: interactive front-end web development book.
-
Read page 98 from the JAVASCRIPT & JQUERY book and then work through the
functions-and-variables.js
file in the day_4/exercises directory to learn more about variable scoping and mutation. -
Read about Javscript return statements: What is a Return Statement?.
-
Work through the
functions.js
file in the day_4/exercises directory. -
Answer the questions in the
questions.md
file in the day_4 directory.
When you are finished with all of the day_4
activities, use your terminal to run the following commands in order to save your work to your local git repository.
$ git add day_4/exercises
$ git add day_4/questions.md
- Use
git add day_4/<filename>
to add all additional files that you created today $ git status
- you should see only green filenames - if you see any that are red, continue togit add
those files untilgit status
shows all green files.$ git commit -m "Add Day 4 Work"
You've save your work to git on your local machine, but it is not yet accessible through your remote GitHub repository. Updating our remote GitHub repository with our local changes is called pushing. Push your code with the following command:
git push origin master
You should now be able to log in to GitHub, navigate to your remote prework repository and see all the work you did today!