Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
ŠŠ¾Š¼Š¾Š³ŠøŃŠµ ŃŠµŃŠøŃŃ? Javascript
ŠŃ ŃŠ¾Š·Š“Š°ŠµŃŠµ ŃŠøŃŃŠ°ŃŠ¾Ń ŃŠµŠŗŃŃŠ°. ŠŠ½ Š“Š¾Š»Š¶ŠµŠ½ ŠøŃŠæŠ¾Š»ŃŠ·Š¾Š²Š°ŃŃ Š½ŠµŃŠŗŠ¾Š»ŃŠŗŠ¾ ŃŠ»Š¾Š² Šø Š²ŃŠ²ŠµŃŃŠø Š² ŃŠµŠ·ŃŠ»ŃŃŠ°Ń ŃŠŗŠ¾Š¼Š±ŠøŠ½ŠøŃŠ¾Š²Š°Š½Š½ŃŃ Š²ŠµŃŃŠøŃ, Š³Š“Šµ ŠŗŠ°Š¶Š“Š¾Šµ ŃŠ»Š¾Š²Š¾ Š¾ŃŠ“ŠµŠ»ŠµŠ½Š¾ Š·Š½Š°ŠŗŠ¾Š¼ $. ŠŠ°ŠæŃŠøŠ¼ŠµŃ, Š“Š»Ń ŃŠ»Š¾Š² "hello", "how", "are", "you", ŃŠµŠ·ŃŠ»ŃŃŠ°Ń Š“Š¾Š»Š¶ŠµŠ½ Š²ŃŠ³Š»ŃŠ“ŠµŃŃ ŃŠ»ŠµŠ“ŃŃŃŠøŠ¼ Š¾Š±ŃŠ°Š·Š¾Š¼ "$hello$how$are$you
quot;. ŠŠ°Š½Š½ŃŠ¹ ŠŗŠ¾Š“ Š¾Š±ŃŃŠ²Š»ŃŠµŃ ŠŗŠ»Š°ŃŃ Add, Ń ŠŗŠ¾Š½ŃŃŃŃŠŗŃŠ¾ŃŠ¾Š¼, ŠŗŠ¾ŃŠ¾ŃŃŠ¹ Š±ŠµŃŠµŃ Š¾Š“ŠøŠ½ rest ŠæŠ°ŃŠ°Š¼ŠµŃŃ. ŠŠ°Š²ŠµŃŃŠøŃŠµ ŠŗŠ¾Š“, Š“Š¾Š±Š°Š²ŠøŠ² Šŗ ŠŗŠ»Š°ŃŃŃ Š¼ŠµŃŠ¾Š“ print(), ŠŗŠ¾ŃŠ¾ŃŃŠ¹ Š“Š¾Š»Š¶ŠµŠ½ ŃŠ¾Š·Š“Š°ŃŃ Š½ŠµŠ¾Š±Ń Š¾Š“ŠøŠ¼ŃŠ¹ ŃŠµŠ·ŃŠ»ŃŃŠ°Ń. class Add { constructor(...words) { this.words = words; } //Š²Š°Ń ŠŗŠ¾Š“ } 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();10 Respostas
+ 3
print(){
var str = this.words.join("quot;);
var b = "quot;+str+"quot;;
console.log(b);
}
}
+ 2
This is my methode, but is not work
+ 1
To me output looks right,
https://code.sololearn.com/WRX2iZ55564V/?ref=app
+ 1
class Add {
constructor(...words) {
this.words = words;
this.print = function(){
var str = this.words.join("quot;);
var b = "quot;+str+"quot;;
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
Š²Š¾Ń, ŃŠ°Š¼ŃŠ¹ Š»ŃŠ³ŠŗŠøŠ¹ ŃŠæŠ¾ŃŠ¾Š±
print() {
var result="quot;;
for(var w of this.words) {
result+=w+"quot;;
}
console.log(result);
}
0
Zharkynbek Idirisov please add the language name in tags , for a second I thought it was python.
0
So where is your print method , like what have you tried so far?
0
Thank you, code ist good
0
print()
{
var result = '#x27;;
for (let w of this.words)
{
result = result + w + "quot;;
}
console.log(result);
}
//looks individual and works;)
0
class Add {
constructor(...words) {
this.words = words;
}
//Š²Š°Ń ŠŗŠ¾Š“
print (){
let sum = "quot;;
this.words.map (el => sum += el+"quot;);
console.log(sum);
}
}
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();