The first example won't replace the variable myApp
if it already exists, and is useful for working in unfamiliar namespaces or when working with global variables. You will have to specify myApp
's properties after creation.
The second example will always create a new version of myApp
and allows you to specify its properties during creation. It will override any other variables already named myApp
.
Both examples create the same 'type' of object--there is only actually one type of object. What makes objects different from each other is the properties they possess.