I want to better understand the effects JavaScript closures have on memory:
function fee(arg){
function figh(){
//some code
fum(passOnSomeARG)
}
function fo(y){
//some calculations with y
}
function fum(x){
//some code
fo(x)
}
figh()
}
In the above example are the inner functions re-read into memory every time “fee()” is called? if so is this efficient? If not then what is happening?
side note: fee() may be called a lot of times in succession (either a loop or a mouse event onmousemove)
I think so, yes. It would be more efficient to do this: