Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

Jude Ricketts Week 3 LDB 8 - #44

Open
LovesPictures wants to merge 1 commit into
CodeYourFuture:mainfrom
LovesPictures:main
Open

Jude Ricketts Week 3 LDB 8 #44
LovesPictures wants to merge 1 commit into
CodeYourFuture:mainfrom
LovesPictures:main

Conversation

@LovesPictures

Copy link
Copy Markdown

No description provided.

@LovesPictures LovesPictures changed the title Initial commit Jude Ricketts Initial commit LDB 8 Jan 19, 2022
@LovesPictures LovesPictures changed the title Jude Ricketts Initial commit LDB 8 Jude Ricketts Week 3 LDB 8 Jan 19, 2022

// Example 1
let a;
let a = 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Simon2828 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, Jude! You have written some excellent code to solve the exercises 😁


function getTemperatureReport(cities) {
// TODO
temp = []; //initialise an array

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice solution!

@Simon2828 Simon2828 added the reviewed A mentor has reviewed this code label Jan 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

reviewed A mentor has reviewed this code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants