DEV Community

Cover image for Day 33 of 100DaysOfCode
Arttu Pyykönen
Arttu Pyykönen

Posted on

Day 33 of 100DaysOfCode

Today I completed the challenges for functional programming at freeCodeCamp and also finished Chapter 8 of Eloquent JavaScript.

Doing them I got more familiar with making pure functions and having fewer side-effects on my code. Also worked on my exception handling skills.

I'm happy that I worked on these as I have a bad habit of not finishing my projects.

What I did today:

1.Finished the functional programming challenges at FCC

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/functional-programming/

What I learned from it:

  • Using the slice method instead of splice
  • Getting more comfortable with this
  • Concatenating strings and arrays
  • Using reduce method on arrays
  • Using the sort method
  • Using forEach, every and some
  • Introduction to arity and currying

2. Finished reading and completed the exercises of EJS CH8

https://eloquentjavascript.net/08_error.html

What I learned from it:

  • Exception handling
  • try and catch
  • Using finally statement
  • Selective error catching

Time spent learning:

Task 'FCC'. Elapsed time: 1 h 1 min 40 s
Task 'Reading_EJS'. Elapsed time: 0 h 25 min 45 s
Task 'EJS_exercises'. Elapsed time: 0 h 22 min 11 s

Total time: 1 h 49 min 36 s

Time spent is tracked by my TaskTimer script and the WakaTime app.

Links and videos

Watch these 10 JavaScript tips by Dev Ed!

Summary of Eloquent JavaScript Chapter 8

"Mistakes and bad input are facts of life. An important part of programming is finding, diagnosing, and fixing bugs. Problems can become easier to notice if you have an automated test suite or add assertions to your programs.

Problems caused by factors outside the program’s control should usually be handled gracefully. Sometimes, when the problem can be handled locally, special return values are a good way to track them. Otherwise, exceptions may be preferable.

Throwing an exception causes the call stack to be unwound until the next enclosing try/catch block or until the bottom of the stack. The exception value will be given to the catch block that catches it, which should verify that it is actually the expected kind of exception and then do something with it. To help address the unpredictable control flow caused by exceptions, finally blocks can be used to ensure that a piece of code always runs when a block finishes."

End of summary. You can find the original from here

Outro

Thank you for reading and see you all tomorrow!

Top comments (0)