/*
//반환 값으로 함수사용
function cal(mode)
{
let funcs =
{
'plus' : function (left, right) {return left + right}
'minus' : function (left, right) {return left, - right}
}
return funcs [mode];
}
alert(cal('plus') (2,1);
alert(cal('minus') (2,1);
//배열의값으로 함수 사용
let process = [
function (input) {return input + 10;},
function (input) {return input * input},
function (input) {return input / 2;}
];
let input = 1;
for(let i = 0; i < process.length; i++){
input - process[i] (input);
}
alert(input);
*/
//큰수 찾기
Number = [20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
sortfunc = function (a, b)
{
console.log(a, b);
if(a > b){
return 1;
} else if (a < b){
return -1;
} else {
return 0;
}
}
console.log(Number.sort(sortfunc));