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

Ldn-class-8-Saf Shah - JS Core 1 - Week 3 - #22

Open
s-shah-coder wants to merge 2 commits into
CodeYourFuture:mainfrom
s-shah-coder:main
Open

Ldn-class-8-Saf Shah - JS Core 1 - Week 3 #22
s-shah-coder wants to merge 2 commits into
CodeYourFuture:mainfrom
s-shah-coder:main

Conversation

@s-shah-coder

Copy link
Copy Markdown

No description provided.

@mahri09 mahri09 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.

@s-shah-coder your code is clean and very good to understand I was glad to read your code, thank you!!!

}
return arr.toString();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

hey, Saf in line 11 when you give the condition while loop you can make it simply (n > arr.length) and it will work!

letter === "8"||
letter === "9") {
newClicks.push(allArticleTitles[i])
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe you already know there is another easy way to find out number inside array I used that
if (/[0-9]/g.test(sentence)) {
titleWithNum.push(sentence);
}

}
return (Math.round(totalLength / allArticleTitles.length))
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you did it an easier way I changed my code after seeing yours thank you Saf!

Comment thread 2-mandatory/4-stocks.js
highestPriceLast5Days = [];
for (let i = 0; i < closingPricesForAllStocks.length; i++) {
highestPriceLast5Days.push(`The highest price of ${stocks[i].toUpperCase()} in the last 5 days was ${Math.max(...closingPricesForAllStocks[i]).toFixed(2)}`);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I have seen it on google using Math.max() it really helps to make easier our work, anyway I also used another way to solve it.

@bec-gray bec-gray 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 job Saf!

}
return arr.toString();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do you need to check if i is even here?

return sumTotal;
}

console.log(evenNumbersSum(3)); // should output 6

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If you print out each number as its being added here you're not actually adding the even numbers, you're adding the product of the even numbers of three. Have a double-check of the logic you're using here.


/* ======= TESTS - DO NOT MODIFY ===== */

function temperatureService(city) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Try and get into the habit of using a more descriptive name for your variable than 'newArray'


return newString;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Another way of doing this is to initialise newString with the first entry, and then you can just check each subsequent entry with only one condition

@bec-gray bec-gray added the reviewed A mentor has reviewed this code label Jan 19, 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