Jump to content

Namespace and Logical OR from a very beginner


bluesFish

Recommended Posts

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");
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...