Advertisement
divanov94

Untitled

Jun 19th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sorting(input){
  2.   let  newArr=[];
  3.   let sorted=input.slice().sort((a,b)=>b-a);
  4.   while(sorted.length!=0){
  5.       newArr.push(sorted.shift());
  6.       newArr.push(sorted.pop());
  7.   }
  8.   console.log(newArr.join(" "));
  9.  
  10.    
  11.    
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement