I can use the following to create a function dynamically in javascript:
var MyClass = new Function("console.log('Hello World!');");
but when I do that, the ID will be set to ‘anonymous’.
I would really like to give such a function an ID for debugging purposes; that’s the id that’s shown when you console.log an instance of such a function(class).
Is there a way to do that?
You can do this by creating a
createfunction like this:DEMO