
Learn Computer Science With JavaScript: Part 4, Functions
IntroductionSuppose you have a file that is 82 lines long and consists only of a series of statements. (I hope this is isn’t true, but anything is possible.) How would you understand what the program does? How would you modify it or use it? It would be kind of hard to do anything with this code because there is no structure to it. To solve this problem, you could use functions. A function is a group of statements that perform a specific task. Functions allow us to break up a program into sma