+ 1
How to solve javascript words coach problem, my code is wrong, where??
class Add { constructor(...words) { this.words = words; } //your code goes here print() { return console.log(this.crypt()); } crypt() { this.words.forEach(x => x+"
quot;); this.words.push("quot;); return (this.words.join("")) } } 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 Respuestas
+ 2
The output was supposed to be the <words> array glued with '#x27; and there should be '#x27; in the beginning and the end of the string, right? the code isn't giving such output ...
And please use relevant tags
https://code.sololearn.com/W3uiji9X28C1/?ref=app
+ 1
crypt() {
let s = "";
this.words.forEach(x => s += x+"quot;);
return (`${s}`); // (s.slice(0, -1));
}