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

Manchester NW5-Maziar Mansouri-JavaScript-Week3 - #123

Open
8maziar wants to merge 4 commits into
CodeYourFuture:mainfrom
8maziar:main
Open

Manchester NW5-Maziar Mansouri-JavaScript-Week3#123
8maziar wants to merge 4 commits into
CodeYourFuture:mainfrom
8maziar:main

Conversation

@8maziar

@8maziar 8maziar commented Sep 19, 2022

Copy link
Copy Markdown

No description provided.

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

Hi Maziar,
I sow your work is amazing and you are hard worker and I looked to exercises/C-while-loop-with-array/exercise.js the function not give a result could you check it please and good luck

@8maziar

8maziar commented Sep 23, 2022

Copy link
Copy Markdown
Author

Hi Maziar, I sow your work is amazing and you are hard worker and I looked to exercises/C-while-loop-with-array/exercise.js the function not give a result could you check it please and good luck

thank you I checked it was alrigth it returns "July 11th"

// TODO
let arr = [];
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.

I think the comment on the function was hinting that you use for of on the titles to iterate through and detect numbers, but a regex is definitely a more efficient 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 alot

let randomNum = generateRandomNumber();

if (randomNum > 50) return randomNum;
} while (1 < 52);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 < 52 will always evaluate top true. While your solution works, I think the point of this exercise is to see if you can use the while clause to stop the loop once you've found a random number greater than 50. E.g.

function getRandomNumberGreaterThan50() {
  let randomNum = 0;
  do {
    randomNum = generateRandomNumber();
  } while (randomNum <= 50);
  return randomNum
}

@8maziar 8maziar Sep 27, 2022

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 Yes I did not pay attention I just check and when all tests passed I did the next one.

*/
function titleWithFewestWords(allArticleTitles) {
// TODO
let str = allArticleTitles[0];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Check the function comment again - the editor wants titles with the fewest words, not the fewest characters.

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.

Yes I should have done that

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.

3 participants