Bonjour,
j'ai une classe avec la methode suivante :
pour l'affichage dans une boucle :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 tempsCompose(id, iPre, temps) { if(this.pronomsP[iPre] ==='noi' || this.pronomsP[iPre] ==='voi' || this.pronomsP[iPre]==='loro') { document.getElementById(id).innerHTML+= `${this.pronomsP[iPre]} ${temps} ${this.participe.participePasse[2]}(e) <br>`; } else { document.getElementById(id).innerHTML+= `${this.pronomsP[iPre]} ${temps} ${this.participe.participePasse[1]}(a) <br>`; } }
Je souhaiterais ne pas avoir document.getElement... dans ma méthode donc j'ai essayé de la manière suivante mais j'ai undefined
Code : Sélectionner tout - Visualiser dans une fenêtre à part verbe.tempsCompose('passeCompose', i, verbe.indicatifEtre.present[i]);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 tempsCompose(iPre, temps) { if(this.pronomsP[iPre] ==='noi' || this.pronomsP[iPre] ==='voi' || this.pronomsP[iPre]==='loro') { `${this.pronomsP[iPre]} ${temps} ${this.participe.participePasse[2]}(e) <br>`; } else { `${this.pronomsP[iPre]} ${temps} ${this.participe.participePasse[1]}(a) <br>`; } }Pouvez vous me dire pourquoi j'ai undefined avec la deuxième méthode ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 document.getElementById('id').innerHTML+= verbe.tempsCompose(i, verbe.indicatifEtre.imparfait[i]);
merci
Partager