<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>中国的流浪猫</title>
</head>
<body>
<script>
var arr = [234, 135, 34, 342234, 243, 3, 432, 3, 43, 24, 54, 5345, 345, 345, 24,]
for (var i = 0; i < arr.length - 1; i++) {
for (var j = 0; j < arr.length - 1 - i; j++) {
if (arr[j] > arr[j + 1]) {
var temp = arr[j]
arr[j] = arr[j + 1]
arr[j + 1] = temp
}
}
}
console.log(arr);
</script>
</body>
</html>
javascript习题(求一个数组中数据的最大值)
最新推荐文章于 2024-08-01 10:36:26 发布