I am new to JavaScript so forgive the simple question - after doing a lot of research, I am even more confused...
The app I am writing had production (display of data etc.) and developer (tools to debug, display internal state etc.) components/source files and I am looking for the best way to keep them separate so that at any point, I can "ship" the production JS file, not ship the developer JS file and things still work.
Currently, I expose functions on both side using the window.x = x paradigm and my production code is peppered with if (mode !== 'prod') type statements.
It feels very inelegant and like there must be a better way.
I looked at using uglify with the hope that it might strip developer code (and any calls to it) but it only seems to remove unused code.
Any pointers about where to look appreciated.
Mollu.