@Gordon, you say in other words that because in line #1 a new code-object - reference-object m (pointing to/referencing related machine object) - is created and then used in a function code-object and held in the array, the reference to m is held on to until the whole menuObject disappears / garbage collected... (Btw, since menuObject is not declared in function, its first use declares it as global and it survives the end of showMenu() function, and stays alive until set again as a new object (menuObjekt = {}), then the previous 'content' is garbage collected.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@Gordon, you say in other words that because in line #1 a new code-object - reference-object m (pointing to/referencing related machine object) - is created and then used in a function code-object and held in the array, the reference to m is held on to until the whole menuObject disappears / garbage collected... (Btw, since menuObject is not declared in function, its first use declares it as global and it survives the end of showMenu() function, and stays alive until set again as a new object (
menuObjekt = {}
), then the previous 'content' is garbage collected.