for example:
//global vars
var g1,g2,g3;
function a(p1,p2,p3){
//local vars
var a1,a2,a3;
return function(){
//an embed function, looks like dynamic defined at runtime
}
}
var f1 = a(1,2,3)
var f2 = a(4,5,6)
f1()
f2()
my question is , is f1 and f2 point to the same code in memory, why they seams diffrent function? does function a spend time to create the embed function when a is call each time?
and GC works also very intresting, local vars of a will not be GC after a executed, It must be GC after the returned embed function GCed, cause of returned embed function still can invoke the local vars of function a.