in order to see garbage collection in action. I want to write a script for chrome enviorment that declares a variable and prints it to the console. and then get collected by garbage collector (- so when I try to access it through dev tools I will get a reference error. according to this link : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management , under Real-life example section - if I use internet explore 7 and run the script:
var div;
window.onload = function() {
div = document.getElementById('myDivElement');
};
which is the example given in the link above but without the circular reference part. if I will try to open ie7 console and try to reach div - I would get a reference error ( like I want ) because div would be garbage collected. how can I do something similar now in chrome?