Why a custom function that works like forEach
?
So we can better conceptualize how forEach
works
Follow the process we learned in https://github.com/SummerOfCode2020/week-04-forking-from-the-org
- Fork
- Clone your personal copy to your local
- cd into the project
- Run
npm install
- Note there were no dependencies for this project
- Run
npm start
to see the output
- In VS Code, add a breakpoint to line 66 in custom-for-each.js
- In VS Code, Open package.json
- Click the "Debug" icon that is above the
scripts
property - Select to debug the
start
script when prompted - Note the variables and the iteration logic we can see in the debugger
- Click the play button for Continue. F8 is the shortcut key as another option
- Note the changing variables
- Repeat clicking Continue to see each iteration and it's variables
- Remove previously set breakpoints
- Add a breakpoint to line 102
- Run the debugger again
- Note the variables
- Click the play button for Continue
- Note the changing variables
- Repeat clicking Continue to see each iteration and it's variables
We will plan to cover this in class to see how we can use this to understand what forEach
does.
Master the forEach