Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

PAR Alice & Julie #494

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

Closed
wants to merge 1 commit into from
Closed

Conversation

juliemnrd
Copy link

@alice.dbrg

var average = sumAverage/array.length
}
return average
}

Choose a reason for hiding this comment

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

To keep your code dry (= avoid repetitions), you can also call the sumArray function that you created earlier.

function averageNumbers(arrayNumber) {
   var sumRes = sumArray(arrayNumber);
   if (arrayNumber.length > 0) {
   var average = sumRes / arrayNumber.length; 
   }
   return average;
 }

Choose a reason for hiding this comment

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

the if statement here ( if (arrayNumber.length > 0) ) is to handle the case when we try to pass an empty array to the function, to please Jasmine :)

@ta-web-paris
Copy link

ta-web-paris commented Aug 8, 2018

The logic is good, remember to indent your code to improve its readability.
Also, remember to change the name of your pull requests to PAR Julie and Alice, otherwise we might miss it :)
Good work!

@juliemnrd juliemnrd changed the title done PAR Alice & Julie Aug 8, 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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.