Consider this multi-level nested JavaScript object.
function foo() {
var channels = {
2: {
name: "station 1",
description: "station1",
img: ["img1-a", "img1-b", "img1-c"]
},
3: {
name: "station 2",
description: "station2",
img: ["img2-a", "img2-b", "img2-c"]
},
4: {
name: "station 3",
description: "station3",
img: ["img3-a", "img3-b", "img3-c"]
},
};
console.log(channels);
};
....
// calling foo.
foo();
After the function foo()
returns, will all the nested objects (i.e. the individual channel objects, strings, the array img, and the strings in img array, all be automatically garbage collected ?
Or, do I need to explicitly iterate through and "delete" each object?