title: Does a matter whether a value is primitive or boxed
body: <p>One can use <code>typeof</code> to determine whether a value is primitive or boxed. </p>
  
  <p>Consider:</p>
  
  <pre><code>typeof "foo"; // "string"
  typeof new String("foo"); // "object"
  </code></pre>
  
  <p>In combination with <code>Object.prototype.toString</code> we could define the following two functions</p>
  
  <pre><code>var toString = Object.prototype.toString;
  
  var is_primitive_string = function(s) {
    return toString.call(s) === "[object String]" &amp;&amp; typeof s === "string";
  };
  
  var is_boxed_string = function(s) {
    return toString.call(s) === "[object String]" &amp;&amp; typeof s === "object";
  };
  </code></pre>
  
  <p>Are there <strong>any use cases</strong> for these two functions? (Or similar functions for <code>Number</code>, <code>Boolean</code>, etc).</p>
  
  <p>The concept behind this question came from the following <a href="https://stackoverflow.com/questions/6792663/javascript-style-optional-callbacks/6792694#6792694">Comment by T.J.Crowder</a>.</p>
  
  <p>Should we ever care whether a value we have is primitive or boxed? </p>