Words project in javascript. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Words project in javascript.

class Add { constructor(...words) { this.words = words; } //your code goes here print(){ console.log('

#x27;+this.words.join('
#x27;)+'
#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(

12th Oct 2021, 2:18 AM
Rashid Ullah
1 Answer
+ 2
U can doo so class Add { constructor(...words) { this.words = words; } //your code goes here print(){ var wrd = "" this.words.forEach(u => { wrd += "
quot;+u; }); wrd += "
quot;; console.log(wrd) } } 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();
18th Oct 2021, 4:15 PM
Utkarsh Gautam