Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
function cmp(a, b){
//a 在前-1,a 在后1
if(a<b) return 1; //a小于b的情况下,a在后
if(a>b) return -1;//a大于b的情况下,a在前
return 0;
var a=[1,10,5,9,2];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment