+ 1
Asking for another solution for this project
https://code.sololearn.com/Wt1bAy0XG4HH/?ref=app This is the final code project from JavaScript Intermediate. I somehow solved this project but I am curious to know any possible and simpler solution for this project instead of my code. (Because Sololearn doesn’t allow me to see solution for this) Thank you for your help in advance.
2 Respostas
+ 7
console.log("quot; + (this.words).join("quot;) + "quot;)
+ 2
class Add {
constructor(...words) {
this.words = words;
}
print() {
let result = "quot;;
for (let word of this.words) {
result += (word + "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");
x.print();
y.print();
z.print();
Here's mine. it's not very different from yours but that's how i solved it