Use object literal notation to create an object assigned to the spot variable, similar to the following constructor function.

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


var spot = {
  warm_blooded: true,
  scaly: false  

Constructor functions and object literal notation can both be used to create JavaScript objects. Constructor functions are better when multiple similar objects are created, but both object construction techniques can be used to make JavaScript objects.


© 2017