The below given code gives an error arguments.sort is not a function. Is it because arguments object cannot be altered directly? Or is it something else.
Any help would be appreciated.
function highest()
{
return arguments.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.");
The assert function is as follows (Just in case)
function assert(pass, msg){
var type = pass ? "PASS" : "FAIL";
jQuery("#results").append("<li class='" + type + "'><b>" + type + "</b> " + msg + "</li>");
}