Words project | Sololearn: Learn to code for FREE!

+7

Words project

It’s still not running can anyone give me a correct code Please i beg you Words project My code class Add { constructor(...words) { this.words = words; } //your code goes here print(){ var y =""; for(x of this.words){ y += `$${x}`; } console.log(‘$y$’); } } 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();

12/17/2020 4:06:27 PM

Emmanuel Osemudiamen

30 Answers

New Answer

+9

class Add { constructor(...words) { this.words = words; this.curWord = ""; } //your code goes here print(){ this.curWord = ""; this.words.map((el,i)=>{ this.curWord+="$"+el; }); console.log(this.curWord+"$"); } } 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(); //This works for me ...read the hint that is given in the problem it will helps you alot

+3

Here is your solution: https://code.sololearn.com/WvZvGEA755Iv/?ref=app

+2

Emmanuel Osemudiamen how did it work?

+2

Zhenis Otarbay SoloLearn updated the challenge code. Now prior attempts that are based on the old code will never pass the test. I discovered that my code, which once passed, now failed. The difference is this line: Old var z = new Add("lorem", "ipsum", "dolor", "sit", "amet", ",", "consectetur", "adipiscing", "elit"); New var z = new Add("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"); They removed the "," from the z word list after "amet". If the quoted comma is in your code, then remove it.

+2

Gabriele Gatti can you give me the correct code with an explanation , please... i tried this work below but it didn't work .... this is yours from 17 days ago ... can you help me class Add { constructor(...words) { this.words = words; this.print = print; } } function print() { var a = this.words.map((word) => "$"+word); var b = a.join(""); console.log(b+"$"); } 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();

+1

can you send it again let me crosscheck it again

+1

class Add { constructor(...words) { this.words = words; } //your code goes here print(){ let y="" for(x of this.words){ y=y+"$"+x; } console.log(y); } } 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();

0

Check those links https://www.sololearn.com/Discuss/2610282/?ref=app https://www.sololearn.com/Discuss/2611466/?ref=app

0

bro can is this the correct code var a = this.words.map((word) => "$"+word); var b = a.join(""); console.log(b+"$");?

0

bro please can you give me the correct code i have tried all my possibe best

0

this is what i saw <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> </body> </html>

0

0

thanks so much ashini gonna try it y

0

it didnt work

0

Emmanuel Osemudiamen I have done it in such a way: https://code.sololearn.com/cbxsm9Vv106d/?ref=app

0

thanks guys it worked

0

Contact manager My code isn’t running . code_ function contact(name, number) { this.name = name; this.number = number; } print() var a = new contact("David", 12345); var b = new contact("Amy", 987654321) a.print(); b.print();

0

please can you give me the correct code with an explanation for my contact manager project

0

Bishoy shnouda as already pointed out here, SoloLearn changed the code. It broke the older solutions. https://www.sololearn.com/post/838036/?ref=app

0

Ok Brain ... but what should i do to take my degree in JS ? this link not work https://www.sololearn.com/post/838036/?ref=app and in my code show to my tis message " this test case is hidden " told my what's problem?