- 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();2 Antworten
+ 2
Remove the comma string in var z.
+ 2
WOW! Thank you @CarrieForle !!! You are great.