I\'m most familiar with Python and somewhat with C, and when I see this syntax in JS it really confuses me
function begin () { console.log(\"done did it\");
The right way is :
window.onload = xxxx;
the xxx must be a function.
the first one:
var fn = function() { alert("abc"); } window.onload = fn;
the other one:
var fn = function() { var abc = "abc"; return function () { alert(abc); } } window.onload = fn();