In JS, a function is a reusable block of code designed to perform a specific task to avoid having to reenter the same information over and over, creating a cleaner code and saving a lot of time. They can be executed as many times as needed.
They are defined by the word ‘function’, followed by whatever you wish to name the function, a set of parentheses (that contain the arguments for the function, however arguments are not necessary for the function to run), and then curly brackets that enclose the code to be executed. Once defined, a function can be used by entering the name and parentheses. The parentheses can be left blank if there are no arguments, but must contain a value if there are. Multiple arguments are separated by commas inside the parentheses.
Hey, Catrina. I like how you explained the function, and it’s importance in JavaScript.
Hey Catrina, I thought your post was extremely well written and straight to the point. The graphic you used only strengthened your post as well, Great job!
Hi Catrina. I really like the image you used for your post. It was a great visual showing how a function is written in Javascript. Visuals are a great way for many people to learn, including myself. Thank you!