Conversation
| function potentialHeadlines(allArticleTitles) { | ||
| // TODO | ||
| } | ||
| const newarray = []; |
There was a problem hiding this comment.
what is the purpose of the const 'newarray'?
| let finalTitle=ARTICLE_TITLES[0]; | ||
| let i=1; | ||
|
|
||
| while(i<ARTICLE_TITLES.length){ |
There was a problem hiding this comment.
In this while loop, you are using 'i' as an iterator to go on loop until it reaches the condition i < ARTICLE_TITLES.length.
Is there another way to improve this loop so it's more clear what it's doing?
There was a problem hiding this comment.
while(i=1, i<ARTICLE_TITLES.length, i++)
| const newarray=[]; | ||
| const number=/[0-9]/; | ||
| let i=0; | ||
| while (i < allArticleTitles.length) { |
There was a problem hiding this comment.
Same as the previous comment from the while loop
| return newarray; | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Just as a nice to have: try to avoid committing unnecessary empty lines like this so we can keep the Pull request cleaner and avoid extra changes
There was a problem hiding this comment.
you are right, thanks for your advice
| // TODO | ||
| let sum=0; | ||
| for (const item of allArticleTitles) { | ||
| sum = (item.length)+sum; |
There was a problem hiding this comment.
why is item.length to be inside the () ?
is there another way to do a 'sum = variable + sum'? a shorter way?
|
|
||
| let FirstPrice = stocksline[0]; | ||
| let i = 1; | ||
| while(i<stocksline.length){ |
There was a problem hiding this comment.
Same comment for the while loop as before
There was a problem hiding this comment.
while(i=1, i<stocksline.length, i++){ }
| const citystrings = []; | ||
|
|
||
| for (const item of cities) { | ||
| citystrings.push( |
There was a problem hiding this comment.
Will be nice to see there String Interpolation👌
There was a problem hiding this comment.
I agree with that 😄 You can read more about template literals in JavaScript here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
| function headlinesWithNumbers(allArticleTitles) { | ||
| // TODO | ||
| const newarray=[]; | ||
| const number=/[0-9]/; |
There was a problem hiding this comment.
I see array like this for the first time, can you explain what it does ? I'm just curious 🙂
There was a problem hiding this comment.
it means that it is(number) integer and it is not a letter or sth else
| } | ||
| const newarray = []; | ||
|
|
||
| for (const item of allArticleTitles) { |
No description provided.