if i add event handler on any element in javascript like
var link = document.createElement("a");
document.body.appendChild(link);
link.addEventListner("click",function(){
alert("do something");
});
and then i remove the link
link.parrentNode.removeChild(link);
then what about event that i attached to link will it also be removed or will it remain in memory (a bit confused with how event are stored in memory and for how long) or should i first remove the the event handler and then i remove the link node.