Skip to content

Instantly share code, notes, and snippets.

@kazu69
Created March 11, 2013 05:13
Show Gist options
  • Save kazu69/5132032 to your computer and use it in GitHub Desktop.
Save kazu69/5132032 to your computer and use it in GitHub Desktop.
Dynamic function names in JavaScript ref http://marcosc.com/2012/03/dynamic-function-names-in-javascript/
"use strict";
var name = "foo";
var func = new Function(
"return function " + name + "(){ alert('sweet!')}"
)();
//call it, to test it
func();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment