- 3

How to add $ to a word in array i need help

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. class Add { constructor(...words) { this.words = words; } //your code goes here } function print(){ var a=words; var b=words; var c=words; a=($+0,$+1,$+3,$+4+$); b=($+0,$+1,$+2+$) c=($+0,$+1,$+2,$+3,$+4,$+5,$+6,$+7+$); console.log(a+b+c); } 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();

15th Jun 2021, 4:04 AM
Cyber DeCypher 🐎
Cyber DeCypher 🐎 - avatar
2 ответов
+ 3
I think you must review the lesson(s) about objects and class, as well as rest parameter ^^
15th Jun 2021, 4:25 AM
visph
visph - avatar
- 1
visph okay i will
15th Jun 2021, 4:38 AM
Cyber DeCypher 🐎
Cyber DeCypher 🐎 - avatar