Jude Ricketts Week 3 LDB 8 - #44
Conversation
|
|
||
| // Example 1 | ||
| let a; | ||
| let a = 1; |
There was a problem hiding this comment.
Dear Jud, the question was why is the given expression undefined so, you are expected to explain. for instance, I said that no value was assigned to the variable when declaring.
| total = 0; //a varialbe to add from the point | ||
| do { | ||
| i++; | ||
| total += i * 2; // adding the even number to total |
There was a problem hiding this comment.
Dear Jud, I was impressed with how you solved this problem using only two variables. Nice job.
|
|
||
|
|
||
| for (let stops of tubeStations) { | ||
| console.log(stops); |
There was a problem hiding this comment.
Nice job! let me drop a little comment I got from my mentor regarding "for of". when you use "for of", you are checking each element of the array so, it is a good practice to write it in a singular form.
for (let stop of tubeStations) {
console.log(stop);
}
Simon2828
left a comment
There was a problem hiding this comment.
Great work, Jude! You have written some excellent code to solve the exercises 😁
|
|
||
| function getTemperatureReport(cities) { | ||
| // TODO | ||
| temp = []; //initialise an array |
There was a problem hiding this comment.
In general, remember to include a keyword (const temp = [] or let temp = []) when declaring variables, otherwise you could be reassigning a value to a global variable - e.g. there might be another temp variable already declared which you are unaware of.
| first = true; // is a control against thinking a title has a length of 0 | ||
| for (title of allArticleTitles) { | ||
| // FOR of loop allows you to declare a verailbe inside to loop | ||
| if (title.split(" ").length < smallesttitle.split(" ").length || first) { |
No description provided.