-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJsArray.html
More file actions
55 lines (54 loc) · 1.56 KB
/
JsArray.html
File metadata and controls
55 lines (54 loc) · 1.56 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Array</h1>
<h2>Syntax</h2>
<script>
const coworkers = ['egoing','leezche'];
document.write(coworkers[1]);
console.log(coworkers)
document.write('<br> 넣기 전:'+coworkers[3]);
coworkers.push('duru'); // Array 메소드 - MDB에서 검색하여 알아내 사용하자!
coworkers.push('taeho');
console.log(coworkers)
document.write('<br> 넣기 후:'+coworkers[3]);
</script>
<h1>Loop</h1>
<ul>
<script>
document.write('<li>1000</li>');
let i = 0;
while(i < 10){ // 반복 시 사용될 조건으로 False가 되기 전까지 반복 실행
document.write(`<li>${i}</li>`);
i++;
}
/*
반복문 - 조건의 True, False에 따라 순서를 제어한다
*/
document.write('<li>111</li>');
</script>
</ul>
<hr>
<h1>[응용]</h1>
<h2>Coworkers</h2>
<ul>
<script>
const workers = ['egoing','leezche','duru','taeho'];
let j = 0;
while(j < workers.length){
document.write('<li>'+workers[j]+'</li>');
j++;
}
/*
중간에 추가되거나 삭제될 때 문제없는 코드일수록 Good!
*/
</script>
</ul>
</body>
</html>