title: How to detect if Moment js is loaded from CDN
body: <p>I want to create a fallback if moment js is not loaded from CDN. I couldn't find any helpful resource online, neither on <a href="https://momentjs.com" rel="noreferrer">momentjs.com</a> to detect if Moment js is present. </p>
  
  <p>Here's my code :</p>
  
  <pre><code>&lt;script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      // If moment.js is not loaded, use the fallback
      if () { 
          document.write('&lt;script src="assets/plugins/moment/moment.min.js"&gt;&lt;\/script&gt;');
      }
  &lt;/script&gt;
  </code></pre>