Hacker News new | ask | show | jobs
by a3n 3423 days ago
> Optional gives us the ability to say “if a value exists, apply this function to it” repeatedly. It also gives us the ability to chain successive calls ...

It sounds like a ternary operator to me.

1 comments

It's not really a ternary operator though, because the value that is tested for existence is only evaluated once, e.g. instead of

    a != null ? fn(a) : null
it's more like

    (a, fn) => a != null ? fn(a) : null