London Class 8 - Irina Shilova - JavaScript-Core-1-Coursework-Week3 London 8 - #14
London Class 8 - Irina Shilova - JavaScript-Core-1-Coursework-Week3 London 8#14IrinShilova wants to merge 3 commits into
Conversation
|
|
||
| function evenNumbers(n) { | ||
| // TODO | ||
| if (n === 0) { |
There was a problem hiding this comment.
Nice implementation! :)
Just keep an eye on indentation, to make the code more readable.
| // TODO | ||
|
|
||
| let i = 0; | ||
| while (birthdays[i].substring(0, 4) !== "July") { |
There was a problem hiding this comment.
This is works and is perfectly fine.
Another way to achieve the same thing here is using the String startsWith method: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
| */ | ||
| function potentialHeadlines(allArticleTitles) { | ||
| // TODO | ||
| let newArticle = []; |
There was a problem hiding this comment.
The implementation here is good. A couple of minor points - indentation in the body of the if-statement would improve readability.
Also, maybe the variable name newArticle could be better, as it is an array that will hold multiple articles.
| function headlinesWithNumbers(allArticleTitles) { | ||
| // TODO | ||
| let arrNum = []; | ||
| for (let i = 0; i < allArticleTitles.length; i++) { |
There was a problem hiding this comment.
This is an interesting implementation :)
You could make this a little bit more efficient using the break keyword. Basically, in the inner loop - if you've already added the current word to the array, you can break out of the loop, and just carry on to the next word.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break
| function getAveragePrices(closingPricesForAllStocks) { | ||
| // TODO | ||
| } | ||
| let averageArr = []; |
There was a problem hiding this comment.
Nice implementation :)
| // TODO | ||
| let priceChange = []; | ||
| for (let i = 0; i < closingPricesForAllStocks.length; i++) { | ||
| priceChange.push(Math.round((closingPricesForAllStocks[i][closingPricesForAllStocks[i].length-1] - closingPricesForAllStocks[i][0]) * 100) / 100); |
There was a problem hiding this comment.
This is good, but it would be a good idea to split this into multiple lines to improve the readability of the code.
| */ | ||
| function highestPriceDescriptions(closingPricesForAllStocks, stocks) { | ||
| // TODO | ||
| let maxPrice = []; |
|
|
||
| function factorial(input) { | ||
| // TODO | ||
| let production = 1; |
|
|
||
| function generateFibonacciSequence(n) { | ||
| // TODO | ||
| let fibArr = [0, 1]; |
|
This is great work @IrinShilova. Very impressive! |
No description provided.