A very fun set of exercises. You will practice:
- Using built-in array methods to filter, map & reduce
- Using
this
- Writing methods that read and write from object data
- Working with type coercion (Strings & Numbers)
- Understanding test cases
- TDD: Test early and test often
This exercise is meant to be studied in the browser. You will need to write the logic for an object that stores strings, sorted by Numberyness & NaNyness. The logic to solving this exercise is all about mapping, filtering & reducing arrays. What will be new is using this
to read and write from properties in an object instead of only working with arguments and local variables.
To complete this exercise clone this repository, open the index.html
locally in your browser, and start coding. Each time you make a change in the object, refresh your browser to see how you did! Here are some ideas you can try to help debug your object:
- Set your DevTools to pause on caught exceptions: this will pause your debugger before the error occurs so you can inspect what was in memory that caused the error.
- Set Breakpoints in your DevTools: In the
sources
tab of your devtools, click on the line number that is causing you trouble. The program will pause there for you to inspect memory. - Use
debugger;
statements: This is very similar to breakpoints, but written into the source code. Breakpoints exist only in the browser you are currently using, debugger statements will pause your code anywhere.
early-return
is a series of exercises that are very similar to the challenges in this repository, you may find it helpful to solve these before attempting the number-organizer
exercises.
You will need to work with type coercion between numbers & strings, avoiding side-effects, and using native array methods. The logic of these exercises is very similar to what you will need for the numbery-organizer
but in a simpler format (pure functions instead of an object). Taking your time to fully understand the early-return
problems will help to solve the numbery-organizer
.