Matt Anderson
Apr 16, 2021

--

I’m not a Javascript developer at all, and know nothing about the implemention details of the Javascript engine. But to me, this seems like a huge amount of extra memory allocation just for an improvement in code readability. Of course it should get thrown away shortly after, but that seems like a lot of time spent at the end of the day.

Also, there’s something to be said about readability vs conciseness. Yes, this approach may work in less lines of code, but a future developer has to stop and ask “wait, what’s going on here?”. Whereas an if/switch statement is already ingrained in our soul and can think about code logic rather than semantics.

Still though, creativity is very important when trying to improve code for the future. Thank you for publishing this article with a very compelling idea!

--

--

Matt Anderson
Matt Anderson

Written by Matt Anderson

Hey, I'm Matt. I'm a software engineer trying to build solo businesses and generally live a happy good life, helping others where I can.

Responses (4)