I am a beginner in JavaScript and i don't quite understand a few things in the following script;
I am aware that Map, Player and App are classes and that map, player and app are instances of those three classes;
But why would you use the keyword "this" with the objects map and player and not just write instead var map = new Map()
and var player = new Player()
?
Any help will be highly appreciated!
var app;
var App = function()
this.map = new Map();
this.player = new Player();
};
(function() {
app = new App();
})();