bluesFish Posted September 17, 2013 Share Posted September 17, 2013 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 More sharing options...
justsomeguy Posted September 17, 2013 Share Posted September 17, 2013 It's creating a variable. The or will set the variable to window.Contoso if it is defined, or else an empty object. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now