It’d be nice to be able to programmatically create named functions. Two less-than-ideal solutions exist:
var name = "someFunction"
eval("var namedFunction = function " + name + "() {}")
console.log(namedFunction) // function someFunction() {}
and
var name = "someFunction"
var namedFunction = new Function("return function " + name + "() {}")()
console.log(namedFunction) // function someFunction() {}
But it’d be nice if we could do something like the following which would be almost equivalent to the previous examples:
var name = "someFunction"
var namedFunction = new Function("", name)
console.log(namedFunction) // function someFunction() {}