Hacker News new | ask | show | jobs
by jeffhuys 1453 days ago
Small sort implementation in ES6:

   const args = process.argv.slice(2).map(Number);

   for (let i = 0; i < args.length; i++)
     for (let j = 0; j < args.length; j++)
       if (args[i] < args[j])
         [args[i], args[j]] = [args[j], args[i]];

   console.log(args.join(' '));
Didn't expect it to be actually that simple, but now that I wrote it, it makes complete sense.

To PROVE it, is another thing. Good work.