+ 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();
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
+ 2
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.
+ 1
can you send it again let me crosscheck it again
+ 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();
+ 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();
+ 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();
0
bro can is this the correct code
var a = this.words.map((word) => "quot;+word);
var b = a.join("");
console.log(b+"quot;);?
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
ashiwini
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