title: how to Custom build a javascript API based on Jquery and some questions about the syntax used in Jquery
body: <p>I come here with quite a bunch of questions so lets start:</p>
  
  <p>I want to know some things about the syntax used to make jquery as I wish to learn from it an use it for my self.</p>
  
  <p>Question 1:
  The starting of the jQuery library <br></p>
  
  <pre>
  <code>
  (function( window, undefined ) {
  
  // Define a local copy of jQuery
  var jQuery = function( selector, context ) {
          // The jQuery object is actually just the init constructor 'enhanced'
          return new jQuery.fn.init( selector, context );
      },
  
      // Map over jQuery in case of overwrite
      _jQuery = window.jQuery, .......
  </code>
  </pre>
  
  <p>I would like to know what is meant by the bracket before the function like so "(function(window..." until now I have only declared my function like this</p>
  
  <pre>
  <code>
  function myFunc(myArg1,myArg2){
  //stuff
  }
  </code>
  </pre>
  
  <p>Question 2:</p>
  
  <p>At the end of the jquery library I seem to understand that the $ sign is assigned in the global scope so that we can use the $ anywhere for the selectors, what i dont understand is that what does the "(window);" expression at the very end mean, and what purpose does it serve.</p>
  
  <pre>
  <code>
          };
  
  });
  // Expose jQuery to the global object
  window.jQuery = window.$ = jQuery;
  
  })(window);
  </code>
  </pre>
  
  <p>My final question is, how can I go about making a globally accessable javascript Object of my own that I can use with lets say "ds.functionName(Arg1);" just like JQuery is used with the $ sign</p>
  
  <p>Thank you :D</p>