allienworks
3/14/2017 - 3:00 PM

overview of JS functions etc.

overview of JS functions etc.

/*
 * anonymous, self-executing functions
 *
 */

(function() {
  // do stuff..
})();


/*
 * bundling functions together
 *
 */

var stuff = {
  first: function(){
    // do first stuff..
  },
  second: function(){
    // do second stuff..
  }
}
stuff.first();


/*
 * same ^ with jQuery
 *
 */

jQuery.stuff = {
  first: function() {
    // do first stuff..
  },
  second: function() {
    // do second stuff..
  }
};
$.stuff.first();