I am using eval
function in a weird way, as a constructor.
try {
var y = new eval()
} catch(error) {
console.log("caught a " + error.name + ": " + error.message);
}
It throws error as,
caught a TypeError: function eval() { [native code] } is not a constructor
As the error message shows, eval is a function but not a constructor.
The question is, don't all javascript functions act as constructors as well?