|
|
|
|
|
by z3t4
3800 days ago
|
|
Yes. It makes things so much simpler. Your program do not have to be complex! It can exist entirely of functions that do not depend on their outer scope. You can basically change everything around them and the function will still work the same. And you do not have to look outside the function to understand what it does. You only have to know about the standard objects witch in JavaScript (ES5) is Math, Date, JSON and Error. Everything else is "required" when needed. |
|
I really don't think require-ing within individual functions is a common or good practice. Can you point me to an open source project that does that?