-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs09_functionArrow.html
More file actions
48 lines (38 loc) · 1.28 KB
/
js09_functionArrow.html
File metadata and controls
48 lines (38 loc) · 1.28 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
<!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>
<h2>화살표 함수 연습</h2>
<div id="view1"></div>
<div id="view2"></div>
<div id="view3"></div>
<div id="view4"></div>
<div id="view5"></div>
<div id="view6"></div>
<script>
document.getElementById("view1").innerText = "a";
function view2Print(){
document.getElementById("view2").innerText = "b";
}
view2Print();
//화살표 함수 구현 후 호출
view3Print = () => {return "c";};
//? view3에 c가 출력
document.getElementById("view3").innerText = view3Print();
//? 두개의 데이터값을 받아서 함한 결과값을 반환하는 화살표 함수 구현
view4Sum = (a, b) => {return a + b;};
document.getElementById("view4").innerText = view4Sum(10, 20);
view5Sum = (a, b) => a + b;
document.getElementById("view5").innerText = view5Sum(100, 200);
view6Sum = (a, b) => {
let data = a + b;
document.getElementById("view6").innerText = data;
};
view6Sum(1000, 2000);
</script>
</body>
</html>