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

-1

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

omar

2 Answers

New Answer

+1

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

+1

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.