-
Notifications
You must be signed in to change notification settings - Fork 6.7k
BCN - Lennie #294
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
BCN - Lennie #294
Conversation
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.
Good job Lennie! 👌
I hope that every method you are using here you know how them work.
Any doubt, just ask us 👌
if (num1>num2) { | ||
return num1; | ||
} else if (num2 > num1) { | ||
return num2; |
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.
Is this moment, mean that num2
is greater or equal than num1
so we can just put return num2
var total = [0]; | ||
for (var j = 0; j < numbersAvg.length; j++) { | ||
total += numbersAvg[j]; | ||
} |
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.
You can reuse your sumArray
} | ||
if (total > 0) { | ||
return total/numbersAvg.length; | ||
} else if (total == 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.
total === 0
} | ||
if (total > 0) { | ||
return total/numbersAvg.length; | ||
} else if (total == 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.
You don't need this. If total > 0
return the average. Else don't do anything. Javascript will return undefined
as default
for (var k = 0; k < wordsArr.length; k++) { | ||
allLetters += wordsArr[k].length; | ||
} | ||
if (allLetters == 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.
You should check this in the beginning of the function and better with something like wordsArr.length > 0
@@ -48,6 +103,15 @@ var wordsUnique = [ | |||
'bring' | |||
]; | |||
|
|||
function uniquifyArray (wordsUnique) { | |||
var wordsNoDuplicates = Array.from(new Set(wordsUnique)); |
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.
Set
! 👍
But you know how a Set
works? 👀
var searchTerm = 'trouble'; | ||
|
||
function doesWordExist (wordsFind, searchTerm) { | ||
return (wordsFind.includes(searchTerm)); |
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.
includes
👍
No description provided.