Glasgow 6 - Hussein Al-Sayed - JS1 week3 - #237
Conversation
from 1st try B-)
not solved copletly, but one attempt closer to success. and couple chatgpt fix suggustions, wich neither works but closer to success.
stocks array elements linked to their coresponding price array seccussfully. little issue however, last string's highest price orints only with onw decimal place!
|
|
||
| citiesReport.push(statement); | ||
| } | ||
| return citiesReport; |
There was a problem hiding this comment.
make sure to keep indentation to the proper level across the code block
| */ | ||
| function titleWithFewestWords(allArticleTitles) { | ||
| // TODO | ||
| let shortestTitle = allArticleTitles[1]; |
There was a problem hiding this comment.
Don't forget that arrays are indexed from 0, not 1. If your list would only contain a single article this code would fail
There was a problem hiding this comment.
right, yeah.. hard to get the new values (0=1) into my brain xD
|
|
||
| for (const title of allArticleTitles){ | ||
| for (const part of title){ | ||
| for (const character of part){ |
There was a problem hiding this comment.
there is a much much better way to calculate the length of a string. In fact you alredy used it in the first exercise in this file
There was a problem hiding this comment.
right, looks much better now.
| // TODO | ||
| let averagePrices = []; | ||
|
|
||
| for (const stock of CLOSING_PRICES_LAST_5_DAYS_FOR_ALL_STOCKS){ |
There was a problem hiding this comment.
indentation is off in multiple places in this loop. Keeping them properly aligned makes it easier to see the flow of the code. Your IDE can help you with that, most also contain a hotkey to auto-indent and fix other styling issues
|
Nice solutions utilizing what you have learned in Week 3. Note the couple of suggestions, and the bug that was raised. |
Co-authored-by: Zsolt Sz. Sztupák <mail@sztupy.hu>
|
@sztupy many thanks for the valuable notes. I've updated the codes accordingly. |
No description provided.