Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joebutler2/9591757 to your computer and use it in GitHub Desktop.
Save joebutler2/9591757 to your computer and use it in GitHub Desktop.

Revisions

  1. @JoeyButler JoeyButler created this gist Jul 2, 2011.
    12 changes: 12 additions & 0 deletions dynamicly-created-functions.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    var funcs = ['functionOne', 'functionTwo', 'functionThree'];
    for(func in funcs) {
    (function (func_name) {
    window[func_name] = function () {
    console.log('My name is ' + func_name);
    }
    })(funcs[func]);
    }

    functionOne();
    functionTwo();
    functionThree();