数据 | 10 | 20 | 30 |
下标 | 0 | 1 | 2 |
<!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>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<script type="text/javascript">
var arr=[96,98,88,92,45,48,56,96,87,55,62,22];
var len = arr.length;
alert(len);
var sum=0;
for(var i=0;i<len;i++){
sum = sum+arr;
}
document.write("学生总成绩为:"+sum);
</script>
</head>
<body>
</body>
</html>
<!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>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<script type="text/javascript">
var arr=[96,98,88,92,45,48,56,96,87,55,62,22];
var len = arr.length;
var sum=0;
for(var i=0;i<len;i++){
sum = sum+arr;
}
var avg = sum/len;
document.write("学生平均成绩为:"+avg);
</script>
</head>
<body>
</body>
</html>
<!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>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<script type="text/javascript">
function bubbleSort(array){
for(var j=0;j<array.length;j++){
<!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>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<script type="text/javascript">
var arr = [
[23,12,56],
[45,12,33],
[34,44,55],
];
var max = arr[0][0];
var xiabiao1 = 0;
var xiabiao2 = 0;
for(var i=0;i<arr.length;i++){
for(var j=0;j<arr.length;j++){
if(max<arr[j]){
max = arr[j];
xiabiao1=i;
xiabiao2=j;
}
}
}
document.write("最大值为:"+max+",下标为:"+xiabiao1+","+xiabiao2);
</script>
</head>
<body>
</body>
</html>
<script type="text/javascript">
var a = [1,2,3];
document.write(a.concat(4,5));
</script>
<script type="text/javascript">
var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
var arr2 = new Array(3)
arr2[0] = "James"
arr2[1] = "Adrew"
arr2[2] = "Martin"
document.write(arr.concat(arr2))
</script>
<script type="text/javascript">
var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
document.write(arr.join())
</script>
<script type="text/javascript">
var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
document.write(arr)
document.write("<br />")
document.write(arr.pop())
document.write("<br />")
document.write(arr)
</script>
<script type="text/javascript">
var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
document.write(arr + "<br />")
document.write(arr.reverse())
</script>
<script type="text/javascript">
document.write(Math.pow(0,0) + "<br />")
document.write(Math.pow(-2,3) + "<br />")
document.write(Math.pow(-2,4) + "<br />")
</script>
<script type="text/javascript">
document.write(Math.abs(7.25) + "<br />")
document.write(Math.abs(-7.25) + "<br />")
document.write(Math.abs(7.25-10))
</script>
wumingze 发表于 2017-6-4 09:26
66666666666666666666啊
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |