搬砖 - js 排序es6

function SortCharVal(pColumn, asc) 
{
    vCoverageListResponse = vCoverageListResponse.sort(function(vObj1, vObj2) {
        if (asc) 
        {
            return (vObj1[pColumn] > vObj2[pColumn]) ? 1 : ((vObj1[pColumn] < vObj2[pColumn]) ? -1 : 0);
        } 
        else 
        {
            return (vObj2[pColumn] > vObj1[pColumn]) ? 1 : ((vObj2[pColumn] < vObj1[pColumn]) ? -1 : 0);
        }
    });
}

 

上一篇:MySQL的一种数据库表死锁场景分析及规避方案


下一篇:Andrew Stankevich Contest 45 (ASC 45)