0

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(); It's showing error why don't know, test is also locked

17th Dec 2020, 11:50 AM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
17 Respostas
+ 1
CarrieForle how did it work?
22nd Dec 2020, 5:33 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
+ 1
There was a recent update to the supplied code, and it breaks older attempts. My old code once passed, but now fails. For the correction see my full explanation in this post. https://www.sololearn.com/Discuss/2630096/?ref=app
22nd Dec 2020, 6:46 AM
Brian
Brian - avatar
0
print = function (){ const myWords = []; for(let i = 0; i <= this.words.length; i++) { myWords.push("
quot;) myWords.push(this.words[i]); } const mySentence = myWords.join("") console.log(mySentence) }
17th Dec 2020, 12:12 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
0
You need another "
quot; at the end of the sentence.
17th Dec 2020, 12:14 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
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(); carrieforle like this ?
17th Dec 2020, 12:22 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
I mean, add "
quot; after every sentence you logged. For example, x.print() should output "$hehe$hoho$haha$hihi$huhu
quot;. But yours is "$hehe$hoho$haha$hihi$huhu". See the difference?
17th Dec 2020, 12:27 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
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 ($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(); It's showing error why don't know, test is also locked
17th Dec 2020, 12:32 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
something like this?
17th Dec 2020, 12:33 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
I mean. In your code: var x = new Add("hehe", "hoho", "haha", "hihi", "huhu"); x.print(); The output will be "$hehe$hoho$haha$hihi$huhu". BUT, the output SoloLearn wants is: "$hehe$hoho$haha$hihi$huhu
quot; Modify your print() and get the output SoloLearn desired. Everything outside of your print() originally is doing great. No need to modify them.
17th Dec 2020, 12:40 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
please can you send your code so i can understand wha u mean
17th Dec 2020, 12:46 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
Okay.... Use console.log(`${y} ); in your original code.
17th Dec 2020, 12:48 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
To be honest i dont understand wha u mean
17th Dec 2020, 1:39 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
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(); It's showing error why don't know, test is also locked
17th Dec 2020, 1:43 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
something like this?
17th Dec 2020, 1:44 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar
0
It's console.log("${y}
quot;)
17th Dec 2020, 1:58 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
You wrote console.log("$y
quot;);
17th Dec 2020, 2:06 PM
你知道規則,我也是
你知道規則,我也是 - avatar
- 2
what i wrote up there is it correct?
17th Dec 2020, 2:01 PM
Emmanuel Osemudiamen
Emmanuel Osemudiamen - avatar