Q:

why do we use Object Constructors

A constructor is a function that creates an instance of a class
  which is typically called an “object”. In JavaScript, a constructor gets 
  called when you declare an object using the new keyword.
  The purpose of a constructor is to create an object and set values if 
  there are any object properties present.
8
function Tree(name) {
  this.name = name
}

let theTree = new Tree('Redwood')
console.log('theTree.constructor is ' + theTree.constructor)
0

New to Communities?

Join the community