임,하지만 난 궁금 일이 : 나는 그것을 생각 http://ejohn.org/apps/learn/#43존 레식 고급 자바 스크립트 질문 내 머리에 약간의
function highest(){
return arguments.slice(1).sort(function(a,b){
return b - a;
});
}
assert(highest(1, 1, 2, 3)[0] == 3, "Get the highest value.");
assert(highest(3, 1, 2, 3, 4, 5)[1] == 4, "Verify the results.");
:
에서 촬영 해야한다 :
Array.prototype.highest = function(){
return arguments.slice(1).sort(function(a,b){
return b - a;
});
}
assert(highest(1, 1, 2, 3)[0] == 1, "Get the highest value.");
assert(highest(3, 1, 2, 3, 4, 5)[1] == 1, "Verify the results.");
그러나 이것은 나에게 정의의 오류를주고있다.
, 잘못은 왜'highest' 첫 번째 매개 변수를 무시하는 Math.max –