[Solved] Sorting strings in javascript [duplicate]


You can convert string to array using split() and reverse the array element using reverse() and then convert result to string again using join() like this:

var Str="8,0,2,10";
var dif = Str.split(',').reverse().join(',');
console.log(dif);

0

solved Sorting strings in javascript [duplicate]