0

I was just studying about prototype in Javascript. I read that, whenever we create a function in javascript, that function will have its prototype.

So, to test this I've created 3 functions, but all with different syntax like below:

//Function statement

function add1(){}

//Function expression

var add2=function(){}

//Arrow function

var add3=()=>{console.log('Javascript')};

After that I tried printing the prototype values of each function like below:

console.log(add1.prototype); //{constructor: ƒ}
console.log(add2.prototype); //{constructor: ƒ}
console.log(add3.prototype); //undefined

Why is arrow function prototype undefined?

Arrow function doesn't have any prototype? OR I am doing something wrong.

Please guide me.

Thanks Dilip Solanki

Dilip Solanki
  • 111
  • 1
  • 2
  • 8

0 Answers0