+ 1

hilfe bei letzter aufgabe js intermed.

ich schaffe es nicht den code richtig zu schreiben ich bekomme immer einen fehler class Add { constructor(...words) { this.words = words; } print() { let result = ""; for (let word of this.words) { result += "

quot; + word; } console.log(result); } } 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();

21st Jan 2025, 10:57 PM
LYZX
LYZX - avatar
1 Respuesta
+ 3
The output needs another "
quot; at the end. After the for loop you could add result += "
quot;;
22nd Jan 2025, 2:21 AM
Brian
Brian - avatar