<html>
<body>
<script type="text/javascript">
var arr = new Array(6)
arr[0] = {Num:10,dd:'k'}
arr[1] ={Num:5,dd:'aa'}
arr[2] = {Num:7,dd:'bbb'}
var ww = arr.sort((a,b)=>{ return b.Num-a.Num});
//for
for (let i = 0; i < arr.length; i++) {
document.write(ww[i].dd)
}
//map
ww.forEach(item => {
document.write(item.dd)
});
</script>
</body>
</html>
与其关联的也进行了对应的排序
arr.sort((a,b)=>{ return b.Num-a.Num});