-
Notifications
You must be signed in to change notification settings - Fork 39
completed final assessment #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| function getCountriesSortedByPopulation(arr) { | ||
| let newArr = [] | ||
| let sorted = arr.sort((a, b) => b.population - a.population) | ||
| sorted.forEach(e => newArr.push(e.country)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since .map() returns an array, can you write this function so that you don't need newArr?
| function isOdd() { | ||
|
|
||
| function isOdd(n) { | ||
| if (n % 2 === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can you use a ternary operator here?
| let count = 0 | ||
| let num = n.toString() | ||
| for (let i of num) { | ||
| count += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a property that strings have which provides us with the number of characters in the string? You can use this property in place of the for loop.
| function sevenBoom(n) { | ||
| let newArr = [] | ||
| for (let i = 1; i <= n; i += 1) { | ||
| if (i % 7 === 0 || i % 10 === 7) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider numbers 70-79; will they be 'BOOM' based on this function? How can you find any number that contains a 7 in any digit?
No description provided.