I was wondering how garbage collection works with functions. With objects, the references are pretty simple and form a tree easily. Is this the same for functions? For example:
(function() {
let b = 2;
let c = 3;
window.a = function() {
console.log(b + c);
}
})();
a(); //prints 5
In this case, b and c are not garbage collected because a has references to them? Is this true?