BEKIR-London-10-JS-Week3-Mandatory+Extra - #234
Conversation
| @@ -12,7 +12,14 @@ | |||
| */ | |||
|
|
|||
| function getTemperatureReport(cities) { | |||
| @@ -5,16 +5,33 @@ | |||
| Implement the function below, which will return a new array containing only article titles which will fit. | |||
| */ | |||
| function potentialHeadlines(allArticleTitles) { | |||
There was a problem hiding this comment.
This is a good solution!
For extra practice, you could try re-writing this with the filter array method.
There was a problem hiding this comment.
Trying other methods and ways of solving code is something I'm going to be aiming for. Thank you.
| Implement the function below, which returns the title with the fewest words. | ||
| (you can assume words will always be seperated by a space) | ||
| */ | ||
| function titleWithFewestWords(allArticleTitles) { |
There was a problem hiding this comment.
Your solution will give you the title with the fewest characters, but this might not be the fewest words.
Can you fix this by making a couple of small changes?
| The Financial Times wants to understand what the average number of characters in an article title is. | ||
| Implement the function below to return this number - rounded to the nearest integer. | ||
| */ | ||
| function averageNumberOfCharacters(allArticleTitles) { |
There was a problem hiding this comment.
Looks perfect! Good job 😄
| @@ -34,9 +35,26 @@ const CLOSING_PRICES_LAST_5_DAYS_FOR_ALL_STOCKS = [ | |||
| Functions can help with this! | |||
| */ | |||
| function getAveragePrices(closingPricesForAllStocks) { | |||
There was a problem hiding this comment.
Good solution, and nicely explained 👍
|
|
||
| for (let i = 0; i < stocks.length; i++) { | ||
| const ticker = stocks[i].toUpperCase(); | ||
| const highestPrice = Math.max(...closingPricesForAllStocks[i]).toFixed(2); |
There was a problem hiding this comment.
Nice use of Math.max
There was a problem hiding this comment.
It's nice finding things and trying things I'm unfamiliar with on Google.
|
|
||
| function isRadioStation(frequency) { | ||
| return getAvailableStations().includes(frequency); | ||
| function getStations() { |
There was a problem hiding this comment.
Great work 😄
A small note, but arrow functions can be simplified even further. In this case, we can write the following:
const radioStations = allFrequencies.filter(frequency => isRadioStation(frequency));|
Overall, great job on this coursework 😄 |
No description provided.