What is the purpose of this line, is it simply creating a namespace and why logical OR operators?
var Contoso = window.Contoso || {}
-------------------------------------------------------------------------------------------------
"use strict";
var Contoso = window.Contoso || {}
Contoso.SiteCollection = function() {
var siteCollection,
context,
getSiteCollectionURL = function() {
var context = new SP.ClientContext.get_current();
var siteCollection = context.get_site();
context.load(siteCollection);
context.executeQueryAsync(onSuccess, onFailure);
},
onSuccess = function () {
alert("Site Collection URL: " + siteCollection.get_url());
},
function onFailure() {
alert("Could not load the site collection");
}