I have a program I am making. Say it has a bunch of function declarations, class declarations, and a bunch of global variable declarations (all bad). Everything could be encapsulated into a class with subclasses, but doing so would be tedious. Is there a better way? Here's a simple example:
var global = "global variable";
var global2 = "global variable 2";
class Global {
constructor(something){
this.something = something;
}
}
function global(something){
return something;
}
How could I turn a file with code such as this, into one big class declaration? Should I do that, or is there a better solution? I'll rewrite it if I truly have to, but it'd be awfully tedious to do so.