Skip to content

Conversation

@JordanAlvarado
Copy link

No description provided.

newArr.sort((a, b) => b.population - a.population)
for(let i in newArr) {
finalArr[i] = newArr[i].country
}

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

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')) {

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){

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?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants