일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- hyperledger transaction
- html video
- #JAVASCRIPT
- html plug-in
- relative path
- #android activity
- #성적관리프로그램
- #자바상속#자바이즈어#is~a
- #C++ 연산자함수오버로딩
- #1차원배열
- html id
- 토큰경제
- mac terminal command
- html object
- docker example
- git flow
- html charset
- #C++ has~a
- #bubbleSort
- #3차원배열
- border-box
- #다차원포인터
- html5 new tag
- html youtube
- 하이퍼레저패브릭
- html multimedia
- #2차원배열
- html code
- #CallByAddress
- #binary
Archives
- Today
- Total
A sentimental robot
Javascript Array 본문
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
73
74
75
76 |
<html>
<title>자바스크립트 배열</title>
<head>
<script language="javascript">
let arr=new Array();
function add(){
var num=document.getElementById("text");
var sp=document.getElementById("res");
arr.push(num.value);
sp.innerHTML=arr;
text.value="";
}
function shift(){
var sp=document.getElementById("res");
alert(arr.shift()+"를 꺼냈습니다.");
sp.innerHTML=arr;
}
function pop(){
var sp=document.getElementById("res");
alert(arr.pop()+"를 꺼냈습니다.");
sp.innerHTML=arr;
}
function reverse(){
var sp=document.getElementById("res");
arr.reverse();
sp.innerHTML=arr;
}
function sort(){
var sp=document.getElementById("res");
arr.sort();
sp.innerHTML=arr;
}
</script>
</head>
<body>
<table border="0">
<tr>
<td><input type="text" id="text" style="width=100%"></td>
<td><input type="button" value="배열에 추가하기" onclick="add()" style="width=100%"></td>
</tr>
<tr>
<td>현재 배열의 값:</td>
<td> <span id="res"></span></td>
</tr>
<tr>
<td><input type="button" value="Shift로 꺼내기" onclick="shift()" style="width=100%"></td>
<td><input type="button" value="Pop으로 꺼내기" style="width=100%" onclick="pop()"></td>
</tr>
<tr>
<td> <input type="button" value="Reverse로 뒤집기" onclick="reverse()" style="width=100%"> </td>
<td> <input type="button" value="Sort로 정렬하기" onclick="sort()" style="width=100%"></td>
</tr>
</body>
</html>
|
cs |
'Web' 카테고리의 다른 글
getElementsByTagName (0) | 2018.10.19 |
---|---|
Background color (0) | 2018.10.19 |
Calculator ver.2 (0) | 2018.10.18 |
Javascript ex2 (0) | 2018.10.18 |
Javascript ex1 (0) | 2018.10.17 |