- 4

You are making a text encryptor. It should take multiple words and output a combined version, where each word is separated by a

5th Jul 2021, 7:14 AM
Shivani Patel
Shivani Patel - avatar
2 Réponses
+ 9
Shivani Patel No need to replace anything and also no need of loop here. You can just do this: console.log("
quot; + (this.words).join("
quot;) + "
quot;);
5th Jul 2021, 7:18 AM
A͢J
A͢J - avatar
+ 2
class Add { constructor(...words) { this.words = words; } //your code goes here print(){ var y =""; for(x of this.words){ x=x.replace(/[^a-zA-Z ]/g, "") if(x!=""){ y += '
#x27;+x; } } console.log(y+'
#x27;); } } 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();
5th Jul 2021, 7:15 AM
Shivani Patel
Shivani Patel - avatar