SHARE
TWEET

Untitled

a guest May 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sort_array(ar) {
  2.     const t = ar.filter(x => x % 2).sort((a, b) => a - b);
  3.     ar.map(e => e % 2 ? t.shift() : e);
  4.     return ar;
  5. }
  6.  
  7. let t = sort_array([1, 43, 26, 31, 19, 74, 5, 4, 13, 3]);
  8. console.log(t);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top