Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function jumbleSorting(numbers) {
- let sortBigtoSmall = numbers.sort((a, b) => b - a)
- let jumbledNum = [];
- while (sortBigtoSmall.length > 0) {
- jumbledNum.push(sortBigtoSmall.shift())
- jumbledNum.push(sortBigtoSmall.pop())
- }
- console.log(jumbledNum.join(' '));
- }
Advertisement
Add Comment
Please, Sign In to add comment