Skip to content

Instantly share code, notes, and snippets.

@edofic
Created March 14, 2016 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edofic/2416c043a3245377ccf5 to your computer and use it in GitHub Desktop.
Save edofic/2416c043a3245377ccf5 to your computer and use it in GitHub Desktop.
dependency injection in JS via eval
function run(exp) {
var magic = "MAGIC!";
return eval(exp);
}
run("1") //1
run("'foo'") //"foo"
run("magic") //"MAGIC!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment