JSFiddle - React, Tailwind, and code Playground
JavaScript
var ary = ["0_11_6_comment", "0_3_6_comment", "0_5_4_comment"];
ary.sort(function (a, b) {
return getSecondInteger(a) > getSecondInteger(b) ? 1 : -1;
});
function getSecondInteger (str) {
return Number(str.split('_')[1]);
}
console.log(ary);