- 2

Javascript - module 8 question - words

Goodmornig to everyone. I've not understand why this is not correct. The otuput is equal to reqested. Why this is incorrect? Thanks in advace to all. class Add { constructor(...words) { this.words = words; } //your code goes here print(){ var lunghezza = this.words.length; var stringaFinale = "

quot;; for (var i = 0; i < lunghezza; i++) { stringaFinale = stringaFinale + this.words[i] + "
quot;; } console.log(stringaFinale); } } var x = new Add("hehe", "hoho", "haha", "hihi", "huhu"); var y = new Add("this", "is", "awesome"); var z = new Add("lorem", "ipsum", "dolor", "sit", "amet", ",", "consectetur", "adipiscing", "elit"); x.print(); y.print(); z.print();

5th May 2021, 12:52 PM
Davide Altieri
Davide Altieri - avatar
2 Respuestas
+ 2
Remove the comma string in var z.
5th May 2021, 1:00 PM
šĹ†Áü•ťĀŹŚČáԾƜąĎšĻüśėĮ
šĹ†Áü•ťĀŹŚČáԾƜąĎšĻüśėĮ - avatar
+ 2
WOW! Thank you @CarrieForle !!! You are great.
5th May 2021, 1:12 PM
Davide Altieri
Davide Altieri - avatar