JSFiddle - React, Tailwind, and code Playground
JavaScript
var a = ["a1", "a2", "a3"],
b = ["b1", "b2", "b3"],
c = ["c1", "c2", "c3"];
function concatAll () {
return [].reduce.call (arguments, function (a,b) {return a.concat (b)},[])
}
var d = concatAll (a,b,c);
alert ("Concatenated " + d) //["a1", "b1", "c1", "a2", "b2", "c2", "a3", "b3", "c3"]
d = d.sort(function (a, b) {
var aVals = a.match(/(\D*)(\d*)/),
bVals = b.match(/(\D*)(\d*)/),
weighted = [a[0] > b[0] ? 1 : a[0] < b[0] ? -1 : 0, b[1] - a[1]] //[string,number]
return weighted[0] - 2 * weighted[1] // give the number a double weight
})
alert ("Sorted " + d);