-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray&loop.html
63 lines (56 loc) · 1.12 KB
/
array&loop.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>array</h1>
<h2>syntax</h2>
<script>
var coworkers = ["egoing", "leezche"];
</script>
<h2>get</h2>
<script>
document.write(coworkers[0]);
document.write(coworkers[1]);
</script>
<h2>add</h2>
<script>
coworkers.push('duru');
coworkers.push('sujin');
</script>
<h2>count</h2>
<script>
document.write(coworkers.length);
</script>
<h1>loop</h1>
<ul>
<script>
document.write('<li>1</li>');
var i =0;
while(i<3){
document.write('<li>2</li>');
document.write('<li>3</li>');
i = i+1;
}
document.write('<li>4</li>');
</script>
</ul>
<h1>Loop & Array</h1>
<script type="text/javascript">
var coworkers = ['soojin', 'daejin', 'jungmin', 'byungmoo']
</script>
<h2>coworkers</h2>
<ul>
<script type="text/javascript">
var i=0;
while(i < coworkers.length){
document.write('<li><a href="http://a.com/'+coworkers[i]+'">'+coworkers[i]+'</a></li>')
i = i+1;
}
</script>
</ul>
</body>
</html>