In a method, this refers to the owner object.
Alone, this refers to the global object.
In a function, this refers to the global object.
In a function, in strict mode, this is undefined.
In an event, this refers to the element that received the event.
Methods like call(), and apply() can refer this to any object.
Meet your new best friend! Along with using debugger in your code, console logging "this" is the most helpful tool for any JS coder. Debugger is helpful when testing out code, but sometimes you don't know what code to even try. When refreshing your index.html page in your browser with the inspect console open, everything that is console logged with "this" will reveal what it represents. This is so helpful when you're trying to determine what data you need to manipulate, and if your output is what you expected. I put this line of code everywhere: in my class constructors, fetch requests, ".catch" errors, and event listeners.
For all your programmers out there:
What are some of your favorite uses for THIS?
Leave me a comment and let me know.
I do have plans to upload the project onto Heroku, but in the meantime, feel free to download the game from GITHUB and have fun with it.
And in the meantime...EXTERMINATE!