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

Manchester NW5_ Adiba Belayete_JS-01_WEEK_03 - #151

Open
Adibab wants to merge 5 commits into
CodeYourFuture:mainfrom
Adibab:main
Open

Manchester NW5_ Adiba Belayete_JS-01_WEEK_03#151
Adibab wants to merge 5 commits into
CodeYourFuture:mainfrom
Adibab:main

Conversation

@Adibab

@Adibab Adibab commented Sep 27, 2022

Copy link
Copy Markdown

No description provided.

for ( let city of cities){
array.push(`The temperature in ${city} is ${temperatureService(city)} degrees`);
}
return 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.

really nice solution & good use of template literals. Could you think of a more explanatory variable name to use here rather than array?

}
while ( number <= 50)
return number

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this works well, well done!

Comment on lines +16 to +18
} else if (allArticleTitles[i].length === 0 ){
sortedArticleTitles = []
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

no need for this else if statement here - are you trying to put a check in for allArticleTitles.length being 0? If so the loop would not run as i < allArticleTitles.length would equate to i < 0 and sortedArticleTitles would get returned as an empty array :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi, yeah I was trying to check for an empty array. So if the input is an empty array then the return should be empty. Now it makes sense that I should not put else if. thank u so much. I am updating my solution.

Comment on lines +32 to +34
for (let i = 0; i < allArticleTitles.length; i++) {
if (allArticleTitles[i].length < fewestWordArticle.length) {
fewestWordArticle = allArticleTitles[i];

@Nomes27 Nomes27 Oct 2, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this is so close! this is a really good solution for checking for the fewest letters, but here we are checking for the fewest words. Using .split(" ") here would help with this, for example:
if (allArticleTitles[i].split(" ").length < fewestWordArticle.split(" ").length) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

thank you so much. I got the point.

// TODO
let newArray = [];
for (let i = 0; i < allArticleTitles.length; i++) {
if (/[0-9]/g.test(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.

using regex here makes sense, well done. You can also use \d for checking for digits, I find this site really useful for trying out different regex patterns https://regex101.com/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

thank you

(sum += allArticleTitles[i].length) / allArticleTitles.length;
}
return Math.floor(avgCharacter);
}

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! remember to remove comments that are no longer relevant when you have reached your solution

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

thanks

Comment thread 2-mandatory/4-stocks.js
Comment on lines +70 to +72
-closingPricesForAllStocks[i][0] +
closingPricesForAllStocks[i][closingPricesForAllStocks.length - 1]
).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.

Nice solution, well done. Your ordering on this line is a little confusing, this would make it more readable (last stock - first stock) :
closingPricesForAllStocks[i][closingPricesForAllStocks.length - 1] - closingPricesForAllStocks[i][0]

Comment thread 2-mandatory/4-stocks.js
Comment on lines +99 to +100
`The highest price of ${stocks[
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.

really well done using the available [i] here to access items in the stocks array rather than creating another loop

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants