1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
    <title>Array</title>
</head>
<body>
    <h1>Array</h1>
    <h2>Syntax</h2>
    <script>
        var coworkers = ["딸기""바나나"];
    </script>
 
    <h2>get</h2>
    <script>
        document.write(coworkers[0]);
    </script>
</body>
</html>
cs


수량세기, 배열추가(push) 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    <h1>Array</h1>
    <h2>Syntax</h2>
    <script>
        var coworkers = ["딸기""바나나"];
    </script>
 
    <h2>Get</h2>
    <script>
        document.write(coworkers[0]);
        document.write('<br>');
        document.write(coworkers[1]);
    </script>
 
    <h2>add</h2>
    <script>
        coworkers.push("우유");
        coworkers.push("빵");
    </script>
 
    <h2>Count</h2>
    <script>
        document.write(coworkers.length);
    </script>
cs


'JavaScript' 카테고리의 다른 글

배열만들고 데이터넣고 꺼내기  (0) 2019.05.25
객체만들기  (0) 2019.05.23
배열과 반복문  (0) 2019.05.22
반복문  (0) 2019.05.22
버튼 누르면 배경이 검정색 흰색으로 변경되게....  (0) 2019.05.22

+ Recent posts