0
Trouble with final “Words” Project on JavaScript
I’ve been trying to figure this out and have read and reread all of Ecma 6 and I’m still lost. Here’s the code I tried and I’ve tried many others but I feel like I have no general direction for what I’m doing. class Add { constructor(...words) { this.words = words; } //my code here print() { Add.forEach(words => { console.log("
quot;); }) } //my code above 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();6 Respuestas
+ 3
what are you expecting as output?
because your code doesn't help us to understand... :(
+ 1
sorry, the output is supposed to output every word for every variable with a dollar sign before and behind it. Ex: $this$is$awesome$
+ 1
print() {
   console.log(☆#x27;+this.words.join('#x27;)+'#x27;);
}
0
class Add {
  constructor(...words) {
      this.words = words;
  }
 	    //my code here
 	   print()	{
 	   this.words.forEach(word => {
 	   	console.log(`${word}`);
 	   })
 
 }
}
       //my code above
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();
you forgot to close class Add , didnt put this.words in forEach
0
for either adjustment to the codes that were suggested, i get the same syntax error saying that var x = new Add is an unexpected identifier.



