Functions are Directions Game
Computers are dumb and can't do anything without you telling it what to do. However, there is a special thing called a function that teaches the computer how to do something. A function, in JavaScript or any programming language, is just a series of directions you teach the computer, so whenever you say the magic word, it runs through all the directions without you having to re-explain every time. Let's try it out.
How you play the game:
1. One person is the computer and one person is the programmers
2. The programmer picks a place on campus, like the bathroom next to the music room, where you could get something and bring it back.
3. The programmer does two things: describes the steps to get there and picks a magic word. This magic word should describe the function. For example, if your function is to go to the bathroom's by the music room and get a towel and bring it back, your magic word should be something like: musicBathTowel. Remember, computers are dumb, so when you're telling your computer how to get to the spot, collect something, and bring it back, be really specific in your directions. If you have to make any turns, go down any stairs, open any doors, or walk forward it's going to be important to include that information.
4. Test your function. The computer does exactly what the person says, no matter what.
5. Every time the programmer says the magic word, computer you have to do the function