← Back to challenges

Sharing is Caring

JavaScriptHardarraysnumbers

Instructions

Given an array of numbers, create a function that removes 25% from every number in the array except the smallest number, and adds the total amount removed to the smallest number.

Examples

showTheLove([4, 1, 4]) ➞ [3, 3, 3]

showTheLove([16, 10, 8]) ➞ [12, 7.5, 14.5]

showTheLove([2, 100]) ➞ [27, 75]

Notes

There will only be one smallest number in a given array.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.