+ 3
Someone help me with js last project
JavaScript last project https://code.sololearn.com/cOHzvJeWQ8EY/?ref=app
5 odpowiedzi
+ 3
It still wrong
+ 3
print(){
let output;
let text = "";
this.words.forEach((words) => {
text += '#x27; + words;
output = text + "quot;;
})
return output;
Use this approach for your print method
+ 2
Change your last 3 lines of codes to-
console.log(x);
console.log(y);
console.log(z);
because print is not used in Javascript, use console.log instead
+ 2
class Add {
constructor(...words) {
this.words = words;
}
//your code goes here
print = ()=>{
const result = (this.words.map(word => "quot; + word)).join("") + "quot;;
console.log(result)
}
}
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");
console.log(x);
console.log(y);
console.log(z);
0
Thanks you guys