What's the purpose of javascript parameters that are overwritten in the function? -


i have code snippet include in project, , i'd know if there's purpose why written or if should clean up. there optimization trick don't know about?

here's (sanitized) code snippet. notice a,b,c,d passed in , assigned in function.

(function (a, b, c, d) {     = '//url/to/js/file.js';     b = document; c = 'script'; d = b.createelement(c); d.src = a; d.type = 'text/java' + c; d.async = true;     = b.getelementsbytagname(c)[0]; a.parentnode.insertbefore(d, a); })(); 

i found this answer after writing question up. reason?

that way can make local scoped variable without explicitly declaring using var statement.

iirc it's commonly used code minifiers.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -