master_Object_prototype_solution
by upigilam
JavaScript
Object.prototype.print = function () {
console.log("in master object :: ", this.pays ? "yes i need this job" : "i will try anither");
}
// base object
var job = function () {
this.pays = true
};
var techJob = function (title, pays) {
job.call(this);
this.title = title;
this.pays = pays;
}
techJob.prototype = Object.create(job.prototype);
console.log('upendra', techJob);
techJob.prototype.constructor = techJob;
let sp = new techJob('js', true);
let sp2 = new techJob('vb', false);
console.log(sp.print());
console.log(sp2.print());