Great article! Js is really a hell in the OOP world.
Itai Edri

I had considered that initially, but I needed something that handle a default case and also allow a non default value to return null or undefined. So that’s why the design was like that.

Though if you have no need for a default case, your example is preferable.

Thanks for sharing!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.