Re:EasyDropzoneJS – open-source JavaScript library for drag&...
by lioeters on Saturday August 05, 2023 @09:37PM
(#37018115)
To the author, here's a common pattern you can use to avoid defining global variables unless it's needed.
[ Parent
| on HN ]
Re:EasyDropzoneJS – open-source JavaScript library for drag&...
by pazvanti on Sunday August 06, 2023 @02:23AM
(#37019470)
Thanks. Will definitely try to improve the code. JavaScript is not my main language and I still have many tricks that I should learn.
Re:EasyDropzoneJS – open-source JavaScript library for drag&...
by lioeters on Sunday August 06, 2023 @06:42AM
(#37020674)
Here is some information about this pattern, it's called Immediately Invoked Function Expression. It's a way to create a function scope so that all variables are local, except for any that you want to "export" as a global.