SOURCE

console 命令行工具 X clear

                    
>
console
var arr = [
  {
      name: '一年级',
      id: 'adas154q45',
  },
  {
      name: '三年级',
      id: 'bad231212',
  },
  {
      name: '二年级',
      id: 'vgs123124a',
  },
  {
      name: '五年级',
      id: 're4342341',
  }, 
  {
      name: '六年级',
      id: 'gfs1414s',
  },
  {
      name: '四年级',
      id: 'dsawq464ew',
  }
]

function compare(property){
  let _arr = ['一','二','三','四','五','六'];
    return function(a,b){
        var value1 = _arr.indexOf(a[property][0]);
        var value2 = _arr.indexOf(b[property][0]);
        return value1 - value2;
    }
}
document.getElementById('app').append(JSON.stringify(arr.sort(compare('name'))))
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>Document</title>
</head>
<body>
  <div id="app"></div>
</body>
</html>