I need some help guys | Sololearn: Learn to code for FREE!


I need some help guys

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$". 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.

12/5/2021 7:08:49 PM


7 Answers

New Answer


OUABI ABDESSAMAD to get useful help from the community,  we need to see your attempt first. without having seen your code, it is difficult to find out where the issue is. => please put your code in playground and link it here thanks!


You must be more specific. Do you need help putting out a fire, or what?


Here is a hint console.log +'$' this. join do some research and put the hint to use.


That is the base code, now use the hint and give it a try 😉 if you get stuck, show your try and help will come


let words = ["hello", "how", "are", "you"]; console.log('$'+words.join('$')+'$'); // or let s="$"; words.forEach(function(word) { s += `${word}$`; }) console.log(s); https://code.sololearn.com/WX3q3h6a1CoV


This is the code class Add { constructor(...words) { this.words = words; } //your code goes here } 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()