new
keyword followed by a call to a constructor function.this
variable within methods so you can access the object’s properties and methods from inside.Example:
var EpicFailVideo = function(epicRating, hasAnimals) { //Constructor function
this.epicRating = epicRating; // Property 1
this.hasAnimals = hasAnimals; // Property 2
}
var parkourFail = new EpicFailVideo(7, false); // Instantiates a new object parkourFail(7,false)
var corgiFail = new EpicFailVideo(4, true); // Instantiates a new object corgiFail(4,true)
console.log(parkourFail);
console.log(corgiFail);
new
keyword instantiates (i.e. creates) an object.