1. let arr = [
    2. {name:'zopp',age:0},
    3. {name:'gpp',age:18},
    4. {name:'yjj',age:8}
    5. ];
    6. function compare(property){
    7. return function(a,b){
    8. let value1 = a[property];
    9. let value2 = b[property];
    10. return value1 - value2;
    11. }
    12. }
    13. console.log(arr.sort(compare('age')))