title: Why is 4 not an instance of Number?
body: <p>Just curious: </p>
  
  <ul>
  <li>4 instanceof Number => false</li>
  <li>new Number(4) instanceof Number => true?</li>
  </ul>
  
  <p>Why is this? Same with strings: </p>
  
  <ul>
  <li><code>'some string' instanceof String</code> returns false</li>
  <li><code>new String('some string') instanceof String</code> => true</li>
  <li><code>String('some string') instanceof String</code> also returns false</li>
  <li><code>('some string').toString instanceof String</code> also returns false</li>
  </ul>
  
  <p>For object, array or function types the instanceof operator works as expected. I just don't know how to understand this.</p>
  
  <p>[<strong>new insights</strong>]</p>
  
  <pre><code>Object.prototype.is = function() {
          var test = arguments.length ? [].slice.call(arguments) : null
             ,self = this.constructor;
          return test ? !!(test.filter(function(a){return a === self}).length)
                 : (this.constructor.name ||
                    (String(self).match ( /^function\s*([^\s(]+)/im )
                      || [0,'ANONYMOUS_CONSTRUCTOR']) [1] );
  }
  // usage
  var Newclass = function(){};  // anonymous Constructor function
  var Some = function Some(){}; // named Constructor function
  (5).is();                     //=&gt; Number
  'hello world'.is();           //=&gt; String
  (new Newclass()).is();        //=&gt; ANONYMOUS_CONSTRUCTOR
  (new Some()).is();            //=&gt; Some
  /[a-z]/.is();                 //=&gt; RegExp
  '5'.is(Number);               //=&gt; false
  '5'.is(String);               //=&gt; true
  </code></pre>