这段代码如何调用?

function create(propertyName) {    return function(object1,object2){
        var value1 = object1[propertyName];
        var value2 = object2[propertyName];        if(value1 < value2) {            return -1;
        } else {            return 0;
        }
    };
}


12345678_0001
浏览 586回答 1
1回答

慕勒3428872

var compareAge=create('age');var a1={&nbsp; age:10};var a2={&nbsp; &nbsp;age:20};console.log(compareAge(a1,a2));
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript