Array.find Returns undefined?

May 28th, 2018 Thoughts.Random() Kerry 1 min read

If Array.find doesn’t find the matching element, it returns undefined. The problem is when you try and pass the result of a find call into a function with a default parameter. If find results in undefined, the default value of the parameter will overwrite it. This isn’t the case if you pass in null. So then you have to end up doing a short-circuit ||,…

TIL: == coerces operands to numbers

Mar 22nd, 2018 Thoughts.Random() Kerry 1 min read

Loose equality operator prefers to compare numbers so the following console.log is never executed:

bar is coerced to 99 and true to 1, and these are not equal.

Notes Part 2: “Functional Programming In Javascript” By Luis Atencio

Nov 4th, 2017 Thoughts.Random() Kerry 2 min read

Continued from Part 1. 3. Few data structures, many operations Control flow “On the other hand, declarative programs, specifically functional ones, raise the level of abstraction by using a minimally structured flow made up of independent black- box operations that connect in a simple topology.Method chaining” Separate control flow from computational logic, i.e. branches and iterations reduced or eliminated in favor of high-level abstractions Method…

Notes Part 1: “Functional Programming In Javascript” By Luis Atencio

Oct 26th, 2017 Thoughts.Random() Kerry 3 min read

I’ve started reading the book Functional Programming In Javascript by Luis Atencio and figured it’d be a good idea to take some notes. Might as well keep them here ^_^ 1.1 What is functional programming (FP)? “Abstract control flows and operations on data with functions to avoid side effects and reduce mutation of state” Fundamental concepts Declarative Easy to reason about Improves readability Pure functions Only…

Hello World!

Sep 20th, 2016 Thoughts.Random() Kerry 2 min read

I’m not a writer. I’m barely a programmer. What am I doing? I bought my own domain and slice of internet a while ago and until now it’s been a vacant lot. I keep getting charged for it. I guess I figured I’d try to build something. I doubt it’ll ever touch the sky but my focus here is on process and not the product. That’s why this blog is…