DEV Community

Discussion on: Objective JS with IIFE

Collapse
 
htissink profile image
Henrick Tissink

Exactly this - the technique becomes really useful when you're limited to older versions of JS. To add to this, how would you declare private members within the class sugar?

Collapse
 
256hz profile image
Abe Dolinger

Makes sense! I didn't see it laid out in the post that this was specifically for older JS. Typescript gives you private and public methods at design time (i.e., private methods become public on compile, but won't compile if used improperly). Doesn't help if you're in a legacy codebase, but at least the possibility has existed for a while!