title: JavaScript types
body: <p>As per <a href="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf" rel="noreferrer">http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf</a>,
  JavaScript has 6 types: <code>undefined</code>, <code>null</code>, <code>boolean</code>, <code>string</code>, <code>number</code> and <code>object</code>.</p>
  
  <pre><code>var und;
  console.log(typeof und); // &lt;-- undefined
  
  var n = null;
  console.log(typeof n); // &lt;--- **object**!
  
  var b = true;
  console.log(typeof b); // &lt;-- boolean
  
  var str = "myString"
  console.log(typeof str); // &lt;-- string
  
  var int = 10;
  console.log(typeof int); // &lt;-- number
  
  var obj = {}
  console.log(typeof obj); // &lt;-- object
  </code></pre>
  
  <p><strong>Question 1:</strong>   </p>
  
  <p>Why is null of type <code>object</code> instead of <code>null</code>?</p>
  
  <p><strong>Question 2:</strong></p>
  
  <p>What about functions?</p>
  
  <pre><code>var f = function() {};
  console.log(typeof f); // &lt;-- function
  </code></pre>
  
  <p>Variable <code>f</code> has type of <code>function</code>. Why isn't it specified in the specification
  as a separate type?</p>
  
  <p>Thanks,</p>