-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.html
More file actions
72 lines (63 loc) · 2.08 KB
/
test.html
File metadata and controls
72 lines (63 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<!--<script type="text/javascript">-->
<!--var a = 15; b = 20;-->
<!--function compare(a,b) {-->
<!--if (a < b){-->
<!--alert("A is less than B");-->
<!--} else if (a > b) {-->
<!--alert("A id greater than B");-->
<!--} else {-->
<!--alert("A id equal to B");-->
<!--}-->
<!--}-->
<!--</script>-->
<!--<script>-->
<!--var str = "我是一个 String 对象 , 我声明在这里 , 但我不是独立存在的!";-->
<!--var obj = { des: "我是一个 Object 对象 , 我声明在这里,我也不是独立存在的。" };-->
<!--var fun = function() { console.log( "我是一个Function 对象!谁调用我,我属于谁:", this ); };-->
<!--obj.fun = fun; console.log( this === window ); // 打印true-->
<!--console.log( window.str === str ); // 打印 true-->
<!--console.log( window.obj === obj ); // 打印true-->
<!--console.log( window.fun === fun ); // 打印 true-->
<!--fun(); // 打印 我是一个 Function对象!谁调用我,我属于谁:window-->
<!--obj.fun(); // 打印 我是一个 Function 对象!谁调用我,我属于谁:obj-->
<!--fun.apply(str); // 打印我是一个 Function 对象!谁调用我,我属于谁:str-->
<!--</script>-->
<script>
// var nums = [];
// for (var i = 0; i < 100; ++i) {
// nums[i] = i+1;
// }
// var samenums = nums;
// nums[0] = 400;
// alert(samenums[0]);
//function copy(arr1, arr2) {
// for (var i = 0; i < arr1.length; ++i) {
// arr2[i] = arr1[i];
// }
//}
//var nums = [];
//for (var i = 0; i < 100; ++i) {
// nums[i] = i+1;
//}
//var samenums = [];
//copy(nums, samenums);
//nums[0] = 400;
//alert(samenums[0]); // 显示 1
function first(word) {
return word[0];
}
var words = ["for","your","information"];
var acronym = words.map(first);
//alert(acronym); // 显示 "f,y,i"
document.write(acronym + "<br>");
document.write(acronym.join(""));
</script>
</body>
</html>