Is this possible? I only want to see if x variable is in memory or not (I don't want to see the total memory usage, etc.), for example, I want that when pressing a button, a boolean variable is initialized, before to set that variable, obviously there is nothing in memory, but after pressing the button, it should now be in memory (and do the same in reverse), how can I see if that variable is actually in memory or not, in the development tools?
I have seen videos on YouTube that do this same exercise and simply put the name of the variable in the search filter of the memory tab (after taking a snapshot) and it appears if it is in memory or not, but when I do it the variable does not appear to me.
let myBoolean; // this can be a number, string, array, etc.
document.getElementById('add').addEventListener('click', () => {
myBoolean = true;
});
document.getElementById('remove').addEventListener('click', () => {
myBoolean = null;
});
Yes. At first, you need to run your code in the browser and create some objects. After you will be able to find it in the memory snapshot.