The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Enforce a null check with composable code branching using Either

Enforce a null check with composable code branching using Either

5:58
We define the Either type and see how it works. Then try it out to enforce a null check and branch our code.
Watch this lesson now
Avatar
egghead.io

We define the Either type and see how it works. Then try it out to enforce a null check and branch our code.

Avatar
Vamshi

I still don't understand how the inspect method works. Anyone please help?
Thanks

Avatar
Brian Lonsdorf

Hi!

Node will implicitly call inspect() on x when you console.log(x). Browsers do not support this so I often use .toString() and log with console.log(String(x))

In reply to Vamshi
Avatar
dirakkk

This set of lessons is awesome ! really

In reply to egghead.io
Avatar
Chapin

For those checking their work on browser you can use instead of node console, as per suggested above.

toString: () => `Right(${x})`
...
console.log(String(result))
Avatar
Dillon

hi. you r a genius

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?