I didn't know you could create a function using new Object:
var myFunc = new Object(function myFunc () {})
Looking at the console, it seems identical to:
function myFunc () {}
Is there a reason to use new Object to create a function?
According to the Object(...)
documentation:
The Object constructor creates an object wrapper for the given value. If the value is null or undefined, it will create and return an empty object, otherwise, it will return an object of a Type that corresponds to the given value. If the value is an object already, it will return the value.
Functions are objects, therefore it will just return the function. The new Object(...)
part is a no-op. So the code is basically just:
var myFunc = function myFunc() { }
and that is barely equal to a function declaration