Anonymous user
Largest int from concatenated ints: Difference between revisions
→ES5
(→ES5) |
|||
Line 855:
<pre>[998764543431, 6054854654]</pre>
===ES6===
<lang JavaScript>var maxCombine = (a) => +(a.sort((x, y) => +("" + y + x) - +("" + x + y)).join(''));
// test & output
console.log([
[1, 34, 3, 98, 9, 76, 45, 4],
[54, 546, 548, 60]
].map(maxCombine));</lang>
=={{header|jq}}==
|