+ 2

Need help on Solving a Code Project 65 JavaScript

The following is my code: class Add { constructor(...words) { this.words = words; } var a = new Add("hello"); var b = new Add("how"); var c = new Add("are"); var d = new Add("you"); console.log(a.words); console.log(b.words); console.log(c.words); console.log(d.words); }

13th Jan 2022, 7:05 PM
Mario Camarillo
3 Réponses
+ 1
class Add { constructor(...words) { this.words = words; }; //your code goes here print() { let te = "
quot;; //text encryptor for(let w of this.words) { te += `${w} ; } console.log(te); }; } 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(); // Good Luck
13th Jan 2022, 7:10 PM
SoloProg
SoloProg - avatar
+ 1
Thank you. It worked.
13th Jan 2022, 7:28 PM
Mario Camarillo
+ 1
class Add { constructor(...words) { this.words = words; } //your code goes here print(){ console.log(`${this.words.join('
#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();
30th Aug 2022, 10:10 AM
Khalid Mesbah
Khalid Mesbah - avatar