+ 2
Please can I get some help regarding the 'Words' Code Project that comes after the module 8 quiz in theSololearnJavaScriptcourse
When the code outputs the words it does what the instruction says that is the $ sign should be printed along with the word that is to the left and right of the word but it does not print it in a horizontal line like it would in an array (except for the bracket and the commas) can someone help with this please, I am done with the course and it is left with that project. class Add { constructor(...words) { this.words = words; } //your code goes here print(){ var p=0; var q=this.words.length; for (var r=0;r<q;r++){ p++; console.log("
quot;+this.words[p]+"quot;) } } } 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();11 Answers
+ 4
If you want you can see that, but better will be when you think about another solution again. Otherwise David Osam please analyse carefully this code:
https://code.sololearn.com/WEw96E0lsJh4/?ref=app
+ 4
A hint : for example, for the words "hello", "how", "are", "you", the output should be "$hello$how$are$youquot;.
And without new line for each word.
+ 3
That is what I'm struggling with so can I get a clear understanding of what I should do
+ 2
Wait a sec
+ 2
You're right but that's exactly the issue I'm facing. I haven't been able to do that
+ 2
I'll send a code snippet soon demonstrating how I can get all to be printed to the console on one line when the function is called. Unfortunately with this method the output has a $ to the left and right of the whole line instead of for the individual words
+ 2
Alright, there it is. So the goal is to print the words with the $ to the left and to the right of each word and also have all the words for that string printed to the console not on new lines when the function is called
+ 2
Woa I owe you one! How did you get that? It would not have occurred to me at all. Thanks a lot. An example like the Words project should be put in one of the JavaScript lessons to guide someone like me next time
+ 1
Another happy customer
+ 1
Yeah. Would have taken me ages to realize that. I'm done with the entire course now so I'll take my time and revisit some of the topics since it's evident that I need more practice