I'm trying to make a memory model for a simple piece of code I have written but I'm not sure how memory works in javascript. Here is the code:
//Recursion.js
var addMe = 0; //simple number to increase
//Recursively add 1 to addMe
var recursiveAddition = function (){
addMe++;
console.log(addMe);
recursiveAddition(); //recursively restart timeout
}
recursiveAddition();
My guess is that following addMe, recursiveAddition just keeps piling up on the stack until I reach the max? No usage of heap in this case? Would this be a correct assumption? Is there other general particularities about javascript(contrary to c++) memory management that I should know about?