title: JS namespace not defined
body: <p>This is a bit odd to me as to why it isn't working in this sense. I have a namespace called
  <strong>PTN128.OPERATIONS</strong> </p>
  
  <p>It is created at the top level of the app in in a global file (some code omitted for space):</p>
  
  <pre><code>var PTN128 = PTN128 || {};
  </code></pre>
  
  <p>I then have a function called </p>
  
  <pre><code>PTN128.namespace = function () 
  </code></pre>
  
  <p>that creates my namespaces by way of </p>
  
  <pre><code>PTN128.namespace("PTN128.OPERATIONS");
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/j12Pu.png" alt="Default page screen shot">
  In my default page I then define what PTN128.OPERATIONS (outside of jQuery stuff) is before I try to call it</p>
  
  <pre><code>PTN128.OPERATIONS = {}
  </code></pre>
  
  <p>It has a function in it called</p>
  
  <pre><code>fncInit: function ()
  </code></pre>
  
  <p>Using jQuery I then call this by way of</p>
  
  <pre><code>(function () {
    PTN128.OPERATIONS.fncInit();
  }());
  </code></pre>
  
  <p>I always see in the console window the error</p>
  
  <pre><code>Uncaught ReferenceError: OPERATIONS is not defined
  </code></pre>
  
  <p>When I do a </p>
  
  <pre><code>(function () {
  console.log(PTN128.OPERATIONS );
  PTN128.OPERATIONS.fncInit();
  }());
  </code></pre>
  
  <p>I see the namespace OPERATIONS with the functions<img src="https://i.stack.imgur.com/pYF73.png" alt="enter image description here">. When I call the function directly from within the console window:</p>
  
  <pre><code>PTN128.OPERATIONS.fncInit();
  </code></pre>
  
  <p>I get the same error.</p>
  
  <p>Everything for the namespace is defined outside of the </p>
  
  <pre><code>(function () {}());
  </code></pre>
  
  <p>I'm a bit lost right now of what to try next. I saw this post <a href="https://stackoverflow.com/questions/8224513/create-namespace-in-document-readyfunction">Create “namespace” in $(document).ready(function() {..});</a> and looking at what I did looks to already be like this. Any help or suggestions would be appreciated.</p>
  
  <p>Thanks.</p>
  
  <hr>
  
  <p>Extra code for test purposes to see it</p>
  
  <pre><code>var PTN128 = PTN128 || {};
  PTN128.namespace = function () {
  var a = arguments, o = null, i, j, d;
  for (i = 0; i &lt; a.length; i = i + 1) {
      d = ("" + a[i]).split(".");
      o = PTN128;
      for (j = (d[0] == "PTN128") ? 1 : 0; j &lt; d.length; j = j + 1) {
          o[d[j]] = o[d[j]] || {};
          o = o[d[j]];
      }
  }
  return o;
  }
  PTN128.namespace("PTN128.OPERATIONS");
  PTN128.OPERATIONS = {
  fncInit: function (console.log('test');
  };
  $(function () {
  console.log(PTN128.OPERATIONS);
  PTN128.OPERATIONS.fncInit();
  }());
  </code></pre>