I'm a young developer and I'm trying to get some best practice down.
I hope my question isn't subject to too much opinion and I can get a standard answer here.
Basically I have a big ol' JS file I wrote, couple thousand lines long. There are three main types of things? (objects?).
- exported functions I use on my node.js server to manipulate data submitted
- variables used by the exported functions and nowhere else
- functions that are called by the exported functions in this file and nowhere else.
I'd like to split them up so that I don't have to scroll so much when making edits. In my head it would make sense to have the three files, with the "exported functions" file calling the variables and functions it needs on top.
Is this common practice? Is there a best way to call variables and functions from another file? Any advice here would be greatly appreciated.