+ 6

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();

17th Dec 2020, 4:06 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
30 Answers
+ 9
class Add { constructor(...words) { this.words = words; this.curWord = ""; } //your code goes here print(){ this.curWord = ""; this.words.map((el,i)=>{ this.curWord+="
quot;+el; }); console.log(this.curWord+"
quot;); } } 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
18th Dec 2020, 6:38 AM
Coder
Coder - avatar
17th Dec 2020, 4:27 PM
Ashwini
Ashwini - avatar
+ 2
Emmanuel Osemudiamen how did it work?
22nd Dec 2020, 5:31 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
+ 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.
22nd Dec 2020, 6:43 AM
Brian
Brian - avatar
+ 1
can you send it again let me crosscheck it again
17th Dec 2020, 4:48 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
+ 1
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) => "
quot;+word); var b = a.join(""); console.log(b+"
quot;); } 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();
3rd Jan 2021, 6:27 PM
Bishoy shnouda
Bishoy shnouda - avatar
+ 1
class Add { constructor(...words) { this.words = words; } //your code goes here print(){ let y="" for(x of this.words){ y=y+"
quot;+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();
3rd Feb 2021, 7:28 PM
Aiden Giuchin
Aiden Giuchin - avatar
+ 1
guys,this worked :- class Add { constructor(...words) { this.words = words; } //your code goes here print(){ let y="" for(x of this.words){ y=y+"
quot;+x; } y=y+"
quot;; 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();
23rd Feb 2021, 7:34 PM
K.Mesbah
K.Mesbah - avatar
0
bro can is this the correct code var a = this.words.map((word) => "
quot;+word); var b = a.join(""); console.log(b+"
quot;);?
17th Dec 2020, 4:18 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
bro please can you give me the correct code i have tried all my possibe best
17th Dec 2020, 4:24 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
this is what i saw <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> </body> </html>
17th Dec 2020, 4:34 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
ashiwini
17th Dec 2020, 4:35 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
thanks so much ashini gonna try it y
17th Dec 2020, 4:43 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
it didnt work
17th Dec 2020, 4:48 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
17th Dec 2020, 5:03 PM
Gabriele Gatti
Gabriele Gatti - avatar
0
thanks guys it worked
17th Dec 2020, 5:21 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
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();
17th Dec 2020, 5:22 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
please can you give me the correct code with an explanation for my contact manager project
17th Dec 2020, 5:24 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
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
3rd Jan 2021, 7:05 PM
Brian
Brian - avatar