JSFiddle - React, Tailwind, and code Playground
JavaScript
function MaClasse(parametre1, parametre2) {
this.attribut1 = parametre1;
this.attribut2 = parametre2;
this.methodePublic = function() {
// Appel d'une méthode privée
methodePrivee();
}
var methodePrivee = (function(prop) {
return function() {// Je veux afficher un attribut public appartenant à la même classe
alert(prop.attribut1);
};
}(this));
}
var obj = new MaClasse("toto", "tutu");
obj.methodePublic();