Someone help me with js last project | Sololearn: Learn to code for FREE!

+3

Someone help me with js last project

JavaScript last project https://code.sololearn.com/cOHzvJeWQ8EY/?ref=app

6/26/2022 6:28:23 PM

Umar Muhammad

5 Answers

New Answer

+3

print(){ let output; let text = ""; this.words.forEach((words) => { text += '$' + words; output = text + "$"; }) return output; Use this approach for your print method

+2

Change your last 3 lines of codes to- console.log(x); console.log(y); console.log(z); because print is not used in Javascript, use console.log instead

+2

It still wrong

+2

class Add { constructor(...words) { this.words = words; } //your code goes here print = ()=>{ const result = (this.words.map(word => "$" + word)).join("") + "$"; console.log(result) } } 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"); console.log(x); console.log(y); console.log(z);

0

Thanks you guys