const extendsTabs = function () {
this.increment = 0;
this.makeTabs = function () {
let _tab = "";
for (let i = 0; i < this.increment; i++) {
_tab += "tab" + (i + 1) + " > ";
}
console.log(_tab);
};
};
const Tabs = function (increment = 0) {
this.increment = increment;
};
const Tabs4 = function () {
this.increment = 3;
};
Tabs.prototype = new extendsTabs();
Tabs4.prototype = Tabs.prototype;
new Tabs().makeTabs();
new Tabs(2).makeTabs();
new Tabs4().makeTabs();
const Personne = function (nom) {
this.name = nom;
this.peutParler = true;
this.salutation = function () {
if (this.peutParler) {
console.log("Bonjour, je suis " + this.nom);
}
};
};
const Employe = function (nom, titre) {
this.nom = nom;
this.titre = titre;
this.salutation = function () {
if (this.peutParler) {
console.log("Bonjour, je suis " + this.nom + ", le " + this.titre);
}
};
};
Employe.prototype = new Personne();
const Client = function (nom) {
this.nom = nom;
};
Client.prototype = new Personne();
const Mime = function (nom) {
this.nom = nom;
this.peutParler = false;
};
Mime.prototype = new Personne();
const bob = new Employe("Bob", "bricoleur");
const joe = new Client("Joe");
const rg = new Employe("Red Green", "réparateur");
const mike = new Client("Mike");
const mime = new Mime("Mime");
bob.salutation();
// Bonjour, je suis Bob, le bricoleur
joe.salutation();
// Bonjour, je suis Joe
rg.salutation();
// Bonjour, je suis Red Green, le réparateur
mike.salutation();
// Bonjour, je suis Mike
mime.salutation();