title: In javascript, If functions are 1st class objects. Then where the varibles which closes over this function gets stored in heaps or stack?
body: <p>I am referencing a answer from stack overflow -->>
   V8 uses a heap similar to JVM and most other languages. This, however, means that local variables (as a general rule) are put on the stack and objects in the heap. This may for instance not hold if a function closes over these values. As in the JVM, primitives can only be stored on the stack if they are stored in a local variable.</p>
  
  <p>As a user it is not something you would normally need to worry about.</p>