[Week 1 - TAAQUI GIPHY] · Lesson 2 · 7 minutes
As we started discussing last time, functions are sets of instructions written to perform a given action. They're basically recipes. If you follow a set of instructions with baking supplies, at the end you get a cake. It's the same idea - except in this case, we're baking with a programming language and the result is dynamic animations and the validation of data.
Or, look at it another way:
We call those ingredients, the things we need to work with, arguments or parameters. They're "passed into" a function the way you would put flour and eggs into a bowl in order to mix them.
Tip: Make sure you save the latest version of your project before you refresh and test your work in a browser. Save and check your work often. Whenever you have your code open in a browser, also, make sure you have the inspector open to see exactly what you've done and how it looks.
So if we go back to our original addEventListener function, we can see that the arguments are the click and the onGoBtnClicked function. Functions can live inside other functions, and work as reactions to things that the user does on the page.