title: Difference between using .bind(this) and wrapping inside function class with JSlint ES5
body: <p>Sorry if i ask similar questions, I am trying to better understand JS with JSlint as well as how this/.bind(this) ties into it.</p>
  
  <p>I have 3 examples below which i am working with. I have figured out why example 1 and 3 behave the way are.</p>
  
  <p>For example 2, i cannot figure out why JSlint complains about the "." in .bind(this).</p>
  
  <p>For example 3, i wonder if there is a way to optimise it?</p>
  
  <p>The code can be copied and pasted into <a href="http://www.jslint.com/" rel="nofollow noreferrer">http://www.jslint.com/</a> to see the results in action.</p>
  
  <h2>Example 1: No JSlint warnings.</h2>
  
  <p>The issue is that "this" does not refer to window or an object which is why it's undefined, which is why it cannot set "this.c". Pretty self explanatory.</p>
  
  <pre><code>/*jslint devel:true, browser:true, this:true*/
  /*global $, window*/
  
  $(function () {
      "use strict";
      window.myApp = (function () {
          this.c = "c";
  
          this.main = function () {
              console.log("MAIN ", this.c);
          };
          this.main();
      }());
  }());
  </code></pre>
  
  <h2>Example 2: JSlint complains about the "." in .bind(this), but otherwise the code is working</h2>
  
  <p>[jslint] Unexpected '.'. (unexpected_a)</p>
  
  <pre><code>/*jslint devel:true, browser:true, this:true*/
  /*global $, window*/
  
  $(function () {
      "use strict";
      window.myApp = (function () {
          this.b = 'b';
  
          this.main = function () {
              console.log('MAIN ', this.b);
          };
          this.main();
      }.bind(this)());
  }.bind(this));
  </code></pre>
  
  <h2>example 3: Wrapping inside function class App</h2>
  
  <p>In this case, JSlint does not show any errors/warnings, it is executed without an issue and all object are accessible.</p>
  
  <pre><code>/*jslint devel:true, browser:true, this:true*/
  /*global $, window*/
  
  $(function () {
      "use strict";
      window.myApp = (function () {
          function App() {
              this.a = "a";
  
              this.main = function () {
                  console.log("MAIN ", this.a);
              };
          }
          var t = new App();
          t.main();
      }());
  }());
  </code></pre>