← Back to challenges

Bring Down The Class Average

JavaScriptHardarraysmathnumbers

Instructions

What is the percentage you can score on a test, which singlehandedly brings down the class average by 5%? Given an array of your classmates' scores, create a function that returns the answer. Round to the nearest percent.

Examples

takeDownAverage(["95%", "83%", "90%", "87%", "88%", "93%"]) ➞ "54%"

takeDownAverage(["10%"]) ➞ "0%"

takeDownAverage(["53%", "79%"]) ➞ "51%"

Notes

  • No tests will include empty arrays or require negative percentages.
  • Note that you need to return a string.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.