With some basic JavaScript principles in hand, we can now expand our skills out even further by exploring callback functions, array methods, and closure. Finish each task in order as the concepts build on one another.
This task focuses on getting practice with higher order functions and callback functions by giving you an array of values and instructions on what to do with that array.
-
Review the contents of the callbacks.js file. Notice you are given an array at the top of the page. Use that array to aid you with your functions.
-
Complete the problems provided to you but skip over stretch problems until you are complete with every other JS file first.
Use .forEach(), .map(), .filter(), and .reduce() to loop over an array with 50 objects in it. The array-methods.js file contains several challenges built around a fundraising 5K fun run event.
-
Review the contents of the array-methods.js file.
-
Complete the problems provided to you but skip over stretch problems until you are complete with every other JS file first.
-
Notice the last three problems are up to you to create and solve. This is an awesome opportunity for you to push your critical thinking about array methods, have fun with it.
We have learned that closures allow us to access values in scope that have already been invoked (lexical scope).
Hint: Utilize debugger statements in your code in combination with your developer tools to easily identify closure values.
- Review the contents of the closure.js file.
- Complete the problems provided to you but skip over stretch problems until you are complete with every other JS file first.
- Go back through the stretch problems that you skipped over and complete as many as you can.
- Look up what an IIFE is in JavaScript and experiment with them