var arr = [
{AddRess: "广州南站", lng: 113.275824, lat: 22.994826, Mileage: "558"},
{AddRess: "长沙南站", lng: 113.071579, lat: 28.15323, Mileage: "883"},
{AddRess: "上海虹桥站", lng: 121.327012, lat: 31.200458, Mileage: "1892"},
{AddRess: "兰州西高铁站", lng: 103.758769, lat: 36.074517, Mileage: "1905"},
{AddRess: "北京南站", lng: 116.385488, lat: 39.87128, Mileage: "2344"},
{AddRess: "呼和浩特东站", lng: 111.772549, lat: 40.855067, Mileage: "2489"},
{AddRess: "拉萨站", lng: 91.076709, lat: 29.629362, Mileage: "2969"},
{AddRess: "哈尔滨西站", lng: 126.584349, lat: 45.713001, Mileage: "3527"},
{AddRess: "乌鲁木齐站", lng: 87.53587, lat: 43.847165, Mileage: "3810"}
];
//先把Mileage转换数字类型
arr .sort((a, b) => (parseFloat(a.Mileage) > parseFloat(b.Mileage)) ? 1 : ((parseFloat(b.Mileage) > parseFloat(a.Mileage)) ? -1 : 0));
js 根据字符串类型的数字排序
最新推荐文章于 2023-10-27 15:34:25 发布
本文档展示了全国主要高铁站的经纬度坐标,按里程排序,从广州南站出发,直至拉萨站,揭示了长途铁路运输的地理距离与信息技术在铁路网络中的应用.

5952

被折叠的 条评论
为什么被折叠?



