title: jQuery plugin Private functions inside Vs. Outside the each loop
body: <p>What is the difference between including private functions in a jQuery plugin in the examples below:</p>
  
  <p>Outside the loop:</p>
  
  <pre><code>    (function( $ ){
        var defaults = {};
  
        $.fn.cmFlex = function(opts) {
  
          this.each(function() {
              var $this = $(this);
              //Element specific options
              var o = $.extend({}, defaults, opts);
  
              //Code here
          });
  
          function f1(){....
          function f3(){....
          function f2(){....
  
        };
      })( jQuery );
  </code></pre>
  
  <p>Inside the loop:</p>
  
  <pre><code>    (function( $ ){
        var defaults = {};
  
        $.fn.cmFlex = function(opts) {
  
          this.each(function() {
              var $this = $(this);
              //Element specific options
              var o = $.extend({}, defaults, opts);
  
              function f1(){....
              function f3(){....
              function f2(){....
          });     
  
  
        };
      })( jQuery );
  </code></pre>
  
  <p>The advantage of including the functions in the loop is that i will be able to access the $this variable as well as the Element specific options from f1() f2() f3(), are there any disadvantages to this?</p>