JavaScript is not a real object-oriented language, it is a prototyping language, that is the difference with other object-oriented languages. In Javascript, you don’t use classes, you create objects from other objects.
Because JavaScript is a functionally scoped language creating a function and/or variable which is not wrapped in another function will result in that variable being created in the global scope (window). To combat this, developers place their classes in Objects.