+ 2

What's wrong here?

class Add { constructor(...words) { this.words = words; } //your code goes here print(){ for(let i of this.words){ this.str += "

quot;+i; } console.log(this.str+"
quot;); } } 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();

29th Jul 2022, 11:41 AM
Bezu Tadesse
Bezu Tadesse - avatar
1 Answer
0
Save code and share link here.. That's helps to debug code for errors if any... edit: Bezu Tadesse this.str += "
quot;+i; before this this.str is undefined. declare it before you using ....
29th Jul 2022, 12:10 PM
Jayakrishna 🇼🇳