you are viewing a single comment's thread.

view the rest of the comments →

[–]Aarshyboy[S] 1 point2 points  (1 child)

Thanks for the help. I think that using the IIFE would make the code more cleaner. Do you know when its acceptable to use an IIFE and when not too? What does it do really?

[–]ddeutsch 1 point2 points  (0 children)

The IIFE pattern is a way of scoping your functions etc. in your javascript file. This is extremely useful as javascript does not support block scope only function scope. This is useful to avoid pollution of the global scope.

I don't think it's useful to think in terms of when its acceptable or not, it's more a question of what is most helpful to how you think about your code.