Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function numbers(input) {
- let numbers = input.split(' ').map(Number).sort((a, b) => b - a);
- let average = (numbers.reduce((a, b) => a + b, 0) / numbers.length);
- let top5 = numbers.filter(n => n > average).slice(0, 5);
- console.log(top5.length == 0 ? "No" : top5.join(' '));
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement