Below I have created two functions f1 as a normal function and f2 as an arrow function, out of which the arrow function could not be instantiated with new keyword with error as below:
var f1 = () => { console.log('f1') }
// undefined
var b = new f1();
// Uncaught TypeError: f1 is not a constructor
while,
function f2() { console.log('f2') }
// undefined
var c = new f2();
// f2
// undefined
both f1 and f2 are of type function as:
typeof f1
// "function"
typeof f2
// "function"
but the normal function f1 has a prototype property having constructor while the function f2 which is an arrow function does not have it
f2.prototype.constructor
// ƒ f2() { console.log('f2') }
f1.prototype
// undefined
Is this a normal behavior of arrow functions as they don't contain prototype property or am I doing something wrong?