0

Not Able to solve Project 6 of JavaScript. Need help...

10th Sep 2022, 9:03 AM
Aman Kumar Sinha
Aman Kumar Sinha - avatar
3 Answers
0
Finally I solved this questions. Felling very exicited. And my js course is also finished...... ----------------------------Problem Statement---------------------------------------------- You are making a text encryptor. It should take multiple words and output a combined version, where each word is separated by a dollar sign $. For example, for the words "hello", "how", "are", "you", the output should be "$hello$how$are$you
quot;. The given code declares a class named Add, with a constructor that takes one rest parameter. Complete the code by adding a print() method to the class, which should generate the requested output. ----------------------------------------My Code---------------------------------------------- class Add { constructor(...words) { this.words = words; } //your code goes here print(){ let a = "
quot;; for(let i=0; i<this.words.length; i++){ a += this.words[i]; a += "
quot;; } console.log(a); } } 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();
10th Sep 2022, 9:23 AM
Aman Kumar Sinha
Aman Kumar Sinha - avatar
+ 4
Attempts?
10th Sep 2022, 9:04 AM
A͢J
A͢J - avatar
0
A͢J Please rate my code. And feel free to give suggestions...
10th Sep 2022, 9:24 AM
Aman Kumar Sinha
Aman Kumar Sinha - avatar