DEV Community

loading...

Discussion on: JS: Functions inside Constants, When, How, and Why to use them

Collapse
darkwiiplayer profile image
DarkWiiPlayer

What you just described is namespacing. It's been a thing in software for decades and depending on the language not doing so can be anything from the norm to a reason to have rotten tomatoes thrown at you. Personally I'm on the side of "always namespace everything", but that's probably just my Lua bias.

Collapse
kailyons profile image
KaiLikesLinux Author

Oh cool, I am a little bit of a newb to programming still, but I love sharing what I learn. I knew people in my sphere of influence who did not know such things and thought I should share how to do it in JavaScript.

Collapse
darkwiiplayer profile image
DarkWiiPlayer

It's definitely not something I see often in the javascript world, which, I assume, is partly due to how its use slowly shifted from very small scripts to add simple interactivity to complete applications that run entirely in javascript.