Rather than using the Firebug console to test I figured I'd just run it from the JS
This page loads two JS files, one on page load, and one when you click the button below, they both run JS functions (1 a global function and the other a function that is a method of an object (so it's namspaced)), the code is identical in every other respect, the two functions are then removed in the second JS file that is loaded and they are triggered again. Any change in the functions after the second load should be very clear
Click to Refresh the Javascript1 { 2 3 alert("function1 has fired with arg: "+arg) 4 5 } 6 7 8 namespace = { 9 10 { 11 alert("function2 has fired with arg: "+arg) 12 } 13 14 } 15 16 // we'll pop these in Try catches just to get the error out to an alert window. 17 18 try{ 19 function1('js1.js'); 20 }catch(e){ 21 alert(e.description); 22 } 23 24 try{ 25 namespace.function2('js1.js'); 26 }catch(e){ 27 alert(e.message); 28 }
1 { 2 3 alert("function1b has fired with arg: "+arg) 4 5 } 6 7 8 namespace = { 9 10 { 11 alert("function2b has fired with arg: "+arg) 12 } 13 14 } 15 16 // we'll pop these in Try catches just to get the error out to an alert window. 17 18 try{ 19 function1('js2.js'); 20 }catch(e){ 21 alert(e.description); 22 } 23 24 try{ 25 namespace.function2('js2.js'); 26 }catch(e){ 27 alert(e.message); 28 }