The concept of globals is starting to solidify. Any variable outside of a function is a global, correct? If variables are contained within $(document).ready( function() { *code* } );, are they considered global?
I figured out a workaround to put a frequently used array into the function that uses said array, but now I am essentially using my HTML content as my globals, if that makes sense (for example, using text inside a div and passing it into a function). Is this how people typically go about constantly changing/often referenced variables?
If they are not globals, should I still enclose the variables inside functions to develop good practice?
No, they’re considered locally scoped inside the function.
Check this out for JavaScript scoping: https://stackoverflow.com/a/500459/1538708
Scoping variables via functions is good practice, especially if you ever want to run your code through a minimizer.