Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

lenniez
Copy link

@lenniez lenniez commented Mar 21, 2018

No description provided.

Copy link
Contributor

@tawebbcn tawebbcn left a 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;
Copy link
Contributor

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];
}
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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));
Copy link
Contributor

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));
Copy link
Contributor

Choose a reason for hiding this comment

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

includes 👍

@tawebbcn tawebbcn closed this Mar 21, 2018
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