[Solved] how to sorting array in javascript [closed]
Try this: var arr = [‘a_1’, ‘a_5’, ‘a_0’, ‘a_4’, ‘a_2’, ‘a_4’]; arr.sort(function(x, y){ return x.split(‘_’)[1] > y.split(‘_’)[1]}); alert(arr); Check this fiddle solved how to sorting array in javascript [closed]