JSFiddle - React, Tailwind, and code Playground

JavaScript

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