Question:

The following code illustrates how to define a constructor function and use the constructor function to create an object.

function Mammal() {
  this.warm_blooded = true;
  this.scaly = false;
}
var fido = new Mammal();

Print the scaly property of the fido object to the console.

Answer:

console.log(fido.scaly);

Constructor functions are specialized JavaScript functions for creating objects. Notice that the fido object could also be created with object literal notation.


Keywords:

© 2017 QuizBucket.org