Array.prototype.slice:数组对象的对象转换数组方法
function sortNum() {
//获取函数传参,返回一个对象。eg:{ '0': 1, '1': 3, '2': 4, '3': 2 }
//return arguments;
//将传参对象转换为数组。eg:[ 1, 3, 4, 2 ]
//return Array.prototype.slice.call(arguments);
//函数传参进行排序。eg:[ 1, 2, 3, 4 ]
return Array.prototype.slice.call(arguments).sort();
}
sortNum(1,3,4,2);
698

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



