Skip to content

Commit 3ce02fc

Browse files
authored
Merge pull request jsk3342#206 from jsk3342/jisu
Solve: 035 문제 해결
2 parents b96338d + 3565d69 commit 3ce02fc

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 문제35 : Factory 함수 사용하기
2+
3+
2제곱, 3제곱, 4제곱을 할 수 있는 Factory 함수를 만들려고 합니다.
4+
5+
<pass>에 코드를 작성하여 two함수를 완성하세요.
6+
7+
```jsx
8+
function one(n){
9+
function two(){
10+
//pass
11+
}
12+
return two;
13+
}
14+
15+
const a = one(2);
16+
const b = one(3);
17+
const c = one(4);
18+
19+
console.log(a(10));
20+
console.log(b(10));
21+
console.log(c(10));
22+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
# 문제35 : Factory 함수 사용하기
3+
4+
2제곱, 3제곱, 4제곱을 할 수 있는 Factory 함수를 만들려고 합니다.
5+
6+
<pass>에 코드를 작성하여 two함수를 완성하세요.
7+
8+
```jsx
9+
function one(n){
10+
function two(){
11+
//pass
12+
}
13+
return two;
14+
}
15+
16+
const a = one(2);
17+
const b = one(3);
18+
const c = one(4);
19+
20+
console.log(a(10));
21+
console.log(b(10));
22+
console.log(c(10));
23+
```
24+
*/
25+
26+
function one(n){
27+
28+
function two(value){
29+
return value**n;
30+
}
31+
return two
32+
}
33+
34+
const a = one(2);
35+
const b = one(3);
36+
const c = one(4);
37+
38+
console.log(a(10));
39+
console.log(b(10));
40+
console.log(c(10));

0 commit comments

Comments
 (0)