I totally understand that in order to learn javascript I need to know how functions work, I understand the basics of passing in parameters and then calling the function with the values to maybe add something together, etc. I’ve read countless articles about functions as well as books, etc., but I just dont get how they are used and when they should be used, etc., the more advanced functions that have maybe 4 parameters and are doing different calculations and returning various values that get fired back into the script just totally confuses me.
What I would like to know is first of all how can I overcome this confusion and also any words of wisdom you may have? I will also add that I have no prior programming experience and have spent the last 2 months frequently hitting my head off a brick wall as I just cant understand javascript.
Functions in programming are similar to functions in math. They take some input and produce an output (well, sometimes they don’t, but they do something). They are great to organize your code, encapsulate functionality and to avoid writing the same code at different places (DRY).
Functions taking more parameters are not necessarily more complex.
Have a look at