Safer JavaScript with the Maybe Type

Andy Van Slaars

Andy Van Slaars

Andy is a full stack JavaScript developer currently working as an enterprise architect for Cengage Learning. In his role, Andy is responsible for strategic technology decisions for educational applications for both web and mobile applications. He loves learning new libraries, languages and tools and is passionate about sharing what he learns with others.

About the Course

JavaScript’s dynamic typing makes it incredibly flexible. That flexibility can lead to trouble though. When values have the potential to change types or to end up as null or undefined, that can lead to runtime errors in our code or bizarre bugs that take forever to track down because of type coercion. To battle this, we end up with code that is littered will conditionals for null or undefined values and type checks, making the core logic harder to read and refactor later.

The Maybe encapsulates the type checking and guards against missing values for us. With Maybe in our toolbelt, we can keep our functions free of all the guardrails, outsource that work to the Maybe and keep our business logic free of all the clutter.