I now have a 4000 line javascript script filled with undeclared references. So essentially what I mean by that is it's filled with lines like
horizontal_position = 4;
without first declaring
var horizontal_position;
When I run it on the browser, this gives me errors like
Uncaught ReferenceError: horizontal_position is not defined
I do have a syntax checker on my vscode, however, there are probably hundreds of undeclared variable references like this, it's not possible for me to go line by line to fix it.
Does anyone know any vscode plugins or other ways to either automatically declare all undeclared variables in the script, or at least print out all undeclared variables so I can copy-paste them and declare all of them at once in the beginning of the script?