+ 2
Need help on Solving a Code Project 65 JavaScript
The following is my code: class Add { constructor(...words) { this.words = words; } var a = new Add("hello"); var b = new Add("how"); var c = new Add("are"); var d = new Add("you"); console.log(a.words); console.log(b.words); console.log(c.words); console.log(d.words); }
3 ответов
+ 1
class Add {
constructor(...words) {
this.words = words;
};
//your code goes here
print() {
let te = "quot;; //text encryptor
for(let w of this.words) {
te += `${w}
;
}
console.log(te);
};
}
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();
// Good Luck
+ 1
Thank you. It worked.
+ 1
class Add {
constructor(...words) {
this.words = words;
}
//your code goes here
print(){
console.log(`${this.words.join('#x27;)}
)
}
}
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();