Anyone know where wrong😢 | Sololearn: Learn to code for FREE!


Anyone know where wrong😢

class Add { constructor(...words) { this.words = words; } //your code goes here } 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

7/24/2021 1:13:03 PM


2 Answers

New Answer


Is print a method of your class coz I see, it's not defined.


Define a print() method in your class, I assume you want output the words property, you may console.log() in the print() method to output the words property bounded value.