Become a member
to unlock all features

Create an egghead account to access 5000+ tutorials and resources from expert developers.

Create account

    Course Introduction: Safer JavaScript with the Maybe type


    JavaScript's dynamic typing makes the language incredibly flexible. That flexibility comes at a cost. Because any variable can potentially be of any type, it's easy to inadvertently introduce runtime Type errors into an application.

    The Maybe data type encapsulates the defensive coding needed to avoid such errors, keeping our application code focused on the task at hand.

    In this course, we'll look at the Maybe type in action. We'll be relying on the Maybe exposed by the crocks library, but the core concepts and much of the API translates to other implementations. We'll learn how to construct a Maybe and apply transformations to data within those safe confines. We'll also cover point-free utility functions that let us build up function compositions for working with Maybes

    After completing this course, you'll have the tools to write safe, declarative JavaScript that can be easily composed while avoiding the unnecessary noise of sprinkling imperative conditional statements throughout your code.