json array sortByProperty

علی ذوالفقار
1402/10/26 21:38:44 (59)
const sortByProperty = (prop) => {
    return function (a, b) {
        if (a[prop] > b[prop])
            return 1;
        else if (a[prop] < b[prop])
            return -1;
        return 0;
    }
};        
Back