SOURCE

let abc=[{name:'abc',aqi:'123'},{name:'a1',aqi:'-'},{name:'a2',aqi:'23'},{name:'a3',aqi:'101'}]

function test(name){
abc.sort((a,b)=>{
    if(a['name']==='-'){a['name']='0';}
    if(b['name']==='-'){a['name']='0';}
    let m=parseFloat(a['name']);
    let n=parseFloat(b['name']);
    if (m < n) return -1;
	else if (m > n) return 1;
	else return 0;
});
}

test('aqi')
console.log(abc);
console 命令行工具 X clear

                    
>
console