title: How does the following Underscore.js code work?
body: <p><em>From the annotated source code:</em></p>
  
  <h3>Create a safe reference to the Underscore object for use below.</h3>
  
  <pre><code> var _ = function(obj) {
      if (obj instanceof _) return obj;
      if (!(this instanceof _)) return new _(obj);
      this._wrapped = obj;
    };
  </code></pre>
  
  <p>I am having a hard time understand what did Jeremy mean by "creating a safe reference", and I am not 100% sure what that code is doing either.</p>
  
  <p>Why not just do: <code>var _ = {}</code>? Where is the <code>obj</code> argument coming from and why do we have to check <strong>instanceof</strong>? Why returning using a <strong>new</strong> operator if it's not <strong>instaneof</strong>? And what is the purpose of the private variable <strong>_wrapped</strong>?</p>