Glasgow 6- Delnia Alipour-JavaScript/Core1- Week 3 - #223
Conversation
shieldo
left a comment
There was a problem hiding this comment.
This is good work! I've made a comment about variable names at one point, but this is minor - the important thing was that you were able to iterate over arrays and come up with working answers. I'd encourage you to investigate the built-in array methods like .map() and .filter() - these will often help out in writing code that is simpler to write and simpler to understand.
Thanks also for the spelling corrections! I can use these and submit them back to the CYF repository 🥇
| */ | ||
|
|
||
| // Example 1 | ||
| // a does'nt have any value. |
There was a problem hiding this comment.
a has the default value for a variable when no assignment has taken place, which is undefined.
| // TODO | ||
| const containNumbers=[]; | ||
| for(let i =0; i<allArticleTitles.length; i++){ | ||
| let isContainNum= /[0-9]/.test(allArticleTitles[i]); |
There was a problem hiding this comment.
Interesting use of a regular expression here!
| let change=0; | ||
| let average=0 | ||
| for(let i =0; i<closingPricesForAllStocks.length; i++){ | ||
| let j=closingPricesForAllStocks[i][closingPricesForAllStocks[i].length-1]; |
There was a problem hiding this comment.
It's usually better to use full descriptions in variable names - variables like I, j and k can be used but usually as counters in loops (as has been used here with i) by convention. Try to think of a quite short but descriptive name to use - it should make the code that uses the variables easier to understand!
No description provided.