JSFiddle - React, Tailwind, and code Playground

by lbstr

JavaScript

var a=[
  {s:"ced",o:{}},
  {s:"cde",o:{}},
  {s:"ade",o:{}},
  {s:"bde",o:{}}
];
              
a.sort(function(a, b){
    if(a.s < b.s){
        return -1;
    }
    if(a.s > b.s){
       return 1;
    }
    return 0;
});
console.log(a);