Untitled

 avatar
unknown
plain_text
9 months ago
517 B
2
Indexable
class Dipendente {
 
    constructor (cognome, mansione, stipendio){
 
        this.cognome = cognome;
        this.mansione = mansione;
        this.stipendio = stipendio;
    }
 
    bonus() {
 
        this.stipendio += 200;
    }
 
    visualizza(){
 
return "Cognome: " + this.cognome + " Mansione: " + this.mansione + " Stipendio: " + this.stipendio;
    }
}
 
var d1 = new Dipendente("Rossi", "funzionario", 2000);
 
console.log(d1.cognome);
console.log(d1.stipendio);
d1.bonus();
console.log(d1.visualizza());
Editor is loading...
Leave a Comment