I recently noticed that my colleague tends to clear any maps before they get dereferenced, such as at the end of a function.
His argument for this is that it's good practice for garbage collection, and I was curious if this is true or a case of over-optimization?
Example:
function useMap() {
const map = new Map();
// do stuff
map.clear();
}