1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Use the Nullish Coalescing Operator to Set Object Defaults

    javascriptJavaScript

    The nulliish coalescing operator (??) allows us to be more explicit when setting object defaults. It allows us to ensure that only values that are "nullish" (either null or undefined) cause the default value to be taken, rather than anything that evaluates to false.

    It's a safer way to operate.

    Please note: This feature is still making its way through the TC39 proposal process. To use it in your project today, you can enable it using Babel's Nullish Coalescing plugin.