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

London9-Lovelace-Mohamed Abdi-JavaScript-Core-1-Coursework-Week3 - #177

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

London9-Lovelace-Mohamed Abdi-JavaScript-Core-1-Coursework-Week3#177
MohamedAbdi114 wants to merge 1 commit into
CodeYourFuture:mainfrom
MohamedAbdi114:main

Conversation

@MohamedAbdi114

Copy link
Copy Markdown

@JDysiewicz JDysiewicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good @MohamedAbdi114 , I've left a couple comments about future uses, but this is looking good :)

function getTemperatureReport(cities) {
// TODO
let tempArray = [];
for (let i = 0; i < cities.length; i++) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How could you rewrite this without a for loop? (Hint: .map() array method)

for (let i = 0; i < allArticleTitles.length; i++) {
average += allArticleTitles[i].length;
}
return parseInt(average / allArticleTitles.length);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What happens here is allARticleTitltes is an empty array?

Comment thread 2-mandatory/4-stocks.js
Comment on lines +65 to +66
let priceChangeBrand = stockPriceBrand[4] - stockPriceBrand[0];
let FormattedPriceChangeBrand = parseFloat(priceChangeBrand.toFixed(2));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

try to use const where possible - also in general functions and variables should be lowerCamelCase, UpperCaselCase (also called PascalCase) is reserved for classes and types

Comment thread 3-extra/1-factorial.js
if (input === 0 || input === 1) {
return 1;
} else {
for (let i = input - 1; i >= 1; i--) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good, how could you rewrite this without a for loop? (https://www.freecodecamp.org/news/how-to-factorialize-a-number-in-javascript-9263c89a4b38/)

@JDysiewicz JDysiewicz added the reviewed A mentor has reviewed this code label Dec 10, 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.

2 participants