<!doctype html>
<html>
<head>
<title>标题</title>
<meta charset="utf-8">
<script>
var arr=[12,3,123,23,2,1];
//function cmp(a,b){return a-b;}
//var cmp=
//function (a,b){return a-b;}
var cmp=
new Function(
"a","b","return a-b");
arr.sort(cmp);
console.log(String(arr));
</script>
</head>
<body>
</body>
</html>
javascript函数定义
最新推荐文章于 2024-08-06 22:21:02 发布