title: Is `Object` a function in JavaScript?
body: <p>Consider this function:</p>
  <pre><code>function Foo(){
      var a = &quot;3&quot;;
  };
  </code></pre>
  <p>According to <em><a href="https://stackoverflow.com/questions/9959727/proto-vs-prototype-in-javascript">__proto__ VS. prototype in JavaScript</a></em>,</p>
  <pre><code>Foo.__proto__ = Function.prototype
  Function.prototype.__proto__ = Object.prototype
  </code></pre>
  <p>I understood that part, but if I do this in the Google Chrome console:</p>
  <pre><code>Object.__proto__
  output: ƒ () { /* native code */ }
  
  Function.__proto__
  output: ƒ () { /* native code */ }
  </code></pre>
  <p><strong>Q1:</strong> Why are they pointing to Function? What actually are <code>Function</code> and <code>Object</code> and how are they different from each other, because <strong><code>Object</code> is actually a function</strong>?:</p>
  <pre><code>typeof Object
  &quot;function&quot;
  </code></pre>
  <p><strong>Q2:</strong> If everything is an object in JavaScript, then why is <code>Object</code> a function? Also, how is a function actually implemented inside JavaScript? What happens to the variables declared inside a function? Is a function converted into an object by the JavaScript compiler?</p>
  <p>Sorry if I am missing something obvious. I am really confused by the way function and object are implemented in JavaScript.</p>