问题:var a = ["aa","vv","bb"];
a.sort((a,b)=>a>b);//["aa", "vv", "bb"],没达到排序效果var a = ["aa","vv","bb"];
a.sort((a,b)=>a>b?1:-1);//["aa", "bb", "vv"],达到排序效果为什么???????? sort是按照返回值-1,1,0排序的么?true,false不好使么?
添加回答
举报
0/150
提交
取消