I have a javascript function which contains another javascript function inside (closure)
function function1() {
$("button").bind("click", function () {
function2();
});
function function2() {
// code
};
};
My question:
When i call function1() for many times, does the function2() gets created each time (and saved in memory)? or it is shared?
function1 is not used as a constructor, so i don't think i should use prototype
window.$.cache[xx].events.click[0].handlerso destroying it would be pretty dangerous :)