Skip to content

Commit b8f190d

Browse files
committed
feat: 고차 함수 개념 추가
1 parent c029039 commit b8f190d

File tree

4 files changed

+36
-33
lines changed

4 files changed

+36
-33
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ folder를 기준으로 예제코드를 관리하고 있으며 사용 할 수 있
66
---
77
순번에 따라 chapter[순번] folder를 정의하고 사용하였습니다.
88

9-
1. 순수함수와 일급함수
9+
1. 순수함수와 일급 함수 그리고 고차 함수
1010
2. 객체지향 프로그래밍과 함수형 프로그래밍
11-
3. 일급 함수를 사용해보자
11+
3. 고차 함수를 사용해보자.

chapter1/2. first-class-function.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@
2020

2121
console.log(functional);
2222
console.log(functional(2, 2));
23-
24-
var functionalExecutor = function (fn) {
25-
return fn();
26-
};
27-
28-
console.log(functionalExecutor(function () {return 1;}));
29-
console.log(functionalExecutor(function () {return 2;}));
3023
</script>
3124
</body>
3225
</html>

chapter1/3. first-class-function-extends.html

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>고차 함수</title>
6+
</head>
7+
<body>
8+
<script>
9+
// 고차 함수란?
10+
// 함수를 매개변수로 사용하거나
11+
// 함수를 반환하는 함수 개념
12+
13+
const functionExecutor = function (fn) {
14+
setTimeout(function () {
15+
fn();
16+
}, 10 * 1000);
17+
};
18+
19+
functionExecutor(function () {console.log(1);});
20+
functionExecutor(function () {console.log(2);});
21+
22+
const division = function (divisionValue) {
23+
return function (value) {
24+
return value / divisionValue;
25+
};
26+
};
27+
28+
const divisionBy10 = division(10);
29+
30+
console.log(divisionBy10(20));
31+
console.log(divisionBy10(33));
32+
</script>
33+
</body>
34+
</html>

0 commit comments

Comments
 (0)