Node.js - Debugging and Profiling
Consider this code snippet:
What will be the output and what memory issue might this cause if keys are never removed?
const cache = {};
function addToCache(key, value) {
cache[key] = value;
}
addToCache('user1', {name: 'Alice'});
addToCache('user2', {name: 'Bob'});
console.log(Object.keys(cache).length);What will be the output and what memory issue might this cause if keys are never removed?
