i am this array:
var notifiche_eq= ["10/avdvidv","15/jcbscisb","7/ciudsu"];
and i would this output:
["15/jcbscisb","10/avdvidv","7/ciudsu"]
so based on numeric characters of each element.
I tried this code but doesn't work:
var notifiche_eq= ["10/avdvidv","15/jcbscisb","7/ciudsu"];
notifiche_eq.sort(function(a, b) {
var milliA= notifiche_eq[a].split('/');
var milliB= notifiche_eq[b].split('/');
milliA= (milliA[0])+0;
milliB= (milliB[0])+0;
if(milliB- milliA){
return b-a;
}
});
alert(notifiche_eq);
here there's jsfiddle: https://jsfiddle.net/13tLjqc0/8/
I hope you can help me and sorry for my english :/