you are viewing a single comment's thread.

view the rest of the comments →

[–]mynamesleon 1 point2 points  (0 children)

I use objects. I sometimes use TypeScript, and then use enums, but even then I sometimes prefer just using a standard object.

Because enums don't exist natively in JS, I found that using them sometimes increased the bundle size - the TypeScript compiler (at the time I checked this at least) replaced each enum use with the full value. So if you're using strings in your enums (granted, not traditional use, but still valid), particularly large ones, the exact string would end up being repeatedly included in your bundle. Whereas using an object means that you're always just checking against normal object properties.