+ 1
Are there any uses for function constructors in javascript?
Constructors like var den = new Function(args, functionBody); are not recommended in javascript according to most resources. what i am wondering , is there time when they become more useful than function declaration and expression? thank you
1 Réponse
+ 1
I think when you declare a function you are in a sense constructing it. So I don't see the point of wanting to use the = new Object method. Because even if it worked. It would have the same result as just declaring the function. It makes it simpler to keep the = new Object method for the purpose it was intended for. To say: var Object = function(arguments) however is pretty common practise and I use it in my codes as well.