LONDON-10/BAKI TUNCER/JAVASCRIPT-3 - #247
Conversation
| return allArticleTitles.filter(title => title.length <= 65); | ||
|
|
||
| } | ||
|
|
| const avarageFixed=avarage.toFixed(2) | ||
|
|
||
| output.push(avarageFixed) | ||
| } |
There was a problem hiding this comment.
Hi Baki
I sew you done nice work here with big effort and I want add here you can use for loop in two time instead to use two function
check here
function getAveragePrices(closingPricesForAllStocks) {
let result = [];
for (let i = 0; i < closingPricesForAllStocks.length; i++) {
let total = 0;
for (let j = 0; j < closingPricesForAllStocks[i].length; j++) {
total += closingPricesForAllStocks[i][j];
}
result.push(parseFloat((total / 5).toFixed(2)));
}
return result;
}
this is my review for this week
Thanks Baki
| @@ -13,6 +13,21 @@ | |||
|
|
|||
| @@ -6,6 +6,9 @@ | |||
| */ | |||
| @@ -15,6 +18,13 @@ function potentialHeadlines(allArticleTitles) { | |||
| */ | |||
There was a problem hiding this comment.
Nice way to solve this one!
The next step is to think about different arrays that might be passed into this function (in the allArticleTitles parameter). What will your code do if allArticleTitles only has one title in the array?
| @@ -32,6 +53,14 @@ function headlinesWithNumbers(allArticleTitles) { | |||
| */ | |||
| @@ -24,6 +34,17 @@ function titleWithFewestWords(allArticleTitles) { | |||
| */ | |||
There was a problem hiding this comment.
Looks like this works!
If you get time, you can experiment with different ways of checking if there's a number in a string - and then have a think about whether one approach might be better than another.
|
|
||
| let output=[] | ||
|
|
||
| for (let i=0 ; i< closingPricesForAllStocks.lenght; i++){ |
There was a problem hiding this comment.
Small typo here 😄 in "lenght"
| let output=[] | ||
|
|
||
| for (let i=0 ; i< closingPricesForAllStocks.lenght; i++){ | ||
| const price = closingPricesForAllStocks[i]; |
There was a problem hiding this comment.
It is worth thinking about the parameter closingPricesForAllStocks. What it is the type of this variable?
From the question above we can see: "it's an array of arrays". So closingPricesForAllStocks[i] is not just one price, it's an array of all the prices for one stock.
|
|
||
| function generateFibonacciSequence(n) { | ||
| // TODO | ||
|
|
There was a problem hiding this comment.
Nice job on this one!
|
Nice work on this coursework @batuncer! |
BAKI TUNCER
WEEK 3
I am struggling with data structure and algorithms