Creating objects from functions
Used to create new object with their own object scope
Creates a brand new object
Links to an Object Prototype
Binds ''this'' to the new object scope
Returns this...
Links to an Object Prototype
Binds ''this'' to the new object scope
Returns this...
let Study = function (course, level) {
this.course = course;
this.level = level;
this.courseLevel = function () {
console.log(this.course + " is for " + this.level);
};
};
let study1 = new Study("Javascript", "Beginners");
let study2 = new Study("Advanced Javascript", "Professionals");
let study3 = new Study("ES new concepts", "Proficients");
study1.courseLevel();
study2.courseLevel();
study3.courseLevel();
//Output
// Javascript is for Beginners
// Advanced Javascript is for Professionals
// ES new concepts is for Proficient