What will be if you set the anonymous function as value of variable
Just imagine, or type in console:
let test = function (){};
let t = new test();
console.log(t.constructor); //ƒ () {}
function Test(){};
let T = new Test();
console.log(T.constructor); //ƒ Test () {}
So, if you want to write code in OOP style, I think, it will be better not to use anonymous functions.
Leave a Reply
You must be logged in to post a comment.