-
Notifications
You must be signed in to change notification settings - Fork 39
Finished final assessment (Jordan) #57
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
| newArr.sort((a, b) => b.population - a.population) | ||
| for(let i in newArr) { | ||
| finalArr[i] = newArr[i].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.
Which array method can you use to return a new array with updated information inside? This array method will replace the two loops you have here.
|
|
||
| function numberOfDigits(n) { | ||
| let i = n.toString() | ||
| return i.length |
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 condense this code to look cleaner? Consider chaining and implicit returns.
| let vowelsRemoved = '' | ||
| while(i < str.length) { | ||
| if((str[i] !== 'a') && (str[i] !== 'e') && (str[i] !== 'i') && (str[i] !== 'o') && (str[i] !== 'u')) { | ||
| if((str[i] !== 'A') && (str[i] !== 'E') && (str[i] !== 'I') && (str[i] !== 'O') && (str[i] !== 'U')) { |
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.
Explore using the .includes() method to make this function more readable.
| let arr = [] | ||
| let i = 1 | ||
| while(i <= n){ | ||
| 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 what would happen to the numbers 70-79. Would you receive the word "BOOM" with every number that contains 7?
No description provided.