DEV Community 👩‍💻👨‍💻

Discussion on: Replace your switch statement and multiple "if and else", using Object Literals - [en-US].

Collapse
akolybelnikov profile image
Andrey Kolybelnikov

I was about to comment with the same when I saw this has already been suggested :)
One more cool little enhancement will allow you to adhere to immutability principle (that is if you'd like to prevent anyone from changing your object properties somewhere in the code later):

Object.freeze(Users)

From now on your object literal is readonly.

Collapse
lukyhenson profile image
Tauan Tathiell Author

hey man thanks for the comment :D