0
What's wrong with my for loop?
class Add { constructor(...words) { this.words = words; } //your code goes here print() { let x = "" for (let word of this.words) { if (word == this.words.length - 1) { x += "
quot; + word + "quot; console.log(word) } else { x += "quot; + word } } console.log(x) } } 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();3 Answers
+ 1
What do you not like about this cycle?
0
It outputs nothing in sololearn's JavaScript ECMA6 practice test
0
You don't have a $ sign at the end, and you're too clever with the code, no conditional expressions are needed here.