0

I would like to know if there is any particular difference between these ways of writing a constructor:

let Bird = function(name, color) {
  this.name = name;
  this.color = color;
  this.numLegs = 2;
}

function Bird() {
  this.name = "Albert";
  this.color  = "blue";
  this.numLegs = 2;
}
  • 2
    Those are not equivalent at all. – Unmitigated Aug 06 '20 at 18:54
  • 2
    Does this answer your question? [var functionName = function() {} vs function functionName() {}](https://stackoverflow.com/questions/336859/var-functionname-function-vs-function-functionname) – rksh1997 Aug 06 '20 at 18:56

0 Answers0