标签:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script> var arr=[12, 8, 99, 19, 112]; arr.sort(function (n1, n2){ if(n1<n2) { return -1; } else if(n1>n2) { return 1; } else { return 0; } }); alert(arr); </script> </head> <body> </body> </html>
标签:
原文地址:http://www.cnblogs.com/zhaozzm/p/4459516.html