Class

class Nb { constructor( x ) { this.x = x; } carre () { return this.x * this.x; } } const p1 = new Nb(2); console.log(p1.carre());