dabidabidesh

sorting

Jun 19th, 2020
306
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sorting1 = arrInput => {
  2.   'use strict'
  3.  
  4.   let numbers = arrInput.slice()
  5.   let result = []
  6.   let array = numbers.sort((a, b) => a - b)
  7.  
  8.   while (array.length !== 0)
  9.     result.push(array.pop(), array.shift())
  10.  
  11.   console.log(result.join(' '))
  12. }
RAW Paste Data