Skip to content

Commit 5a22aaa

Browse files
committed
Solve: 11-12번문제해결
1 parent b567efc commit 5a22aaa

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 문제11 : for를 이용한 기본 활용
2+
3+
1부터 100까지 모두 더하는 Code를 <pass> 부분에 완성하세요. `for`를 사용해야 합니다.
4+
5+
```jsx
6+
let s = 0;
7+
8+
//pass
9+
10+
console.log(s);
11+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
# 문제11 : for를 이용한 기본 활용
3+
4+
1부터 100까지 모두 더하는 Code를 <pass> 부분에 완성하세요. `for`를 사용해야 합니다.
5+
6+
let s = 0;
7+
8+
//pass
9+
for(let i=1; i<=100; i++) {
10+
s += i;
11+
}
12+
console.log(s);
13+
*/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 문제12 : 게임 캐릭터 클래스 만들기
2+
3+
다음 소스코드에서 클래스를 작성하여 게임 캐릭터의 능력치와 '파이어볼'이 출력되게 만드시오.
4+
**주어진 소스 코드를 수정해선 안됩니다.**
5+
6+
```jsx
7+
**데이터**
8+
<여기에 class를 작성하세요.>
9+
10+
const x = new Wizard(545, 210, 10);
11+
console.log(x.health, x.mana, x.armor);
12+
x.attack();
13+
14+
**출력**
15+
545 210 10
16+
파이어볼
17+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
# 문제12 : 게임 캐릭터 클래스 만들기
3+
4+
다음 소스코드에서 클래스를 작성하여 게임 캐릭터의 능력치와 '파이어볼'이 출력되게 만드시오.
5+
**주어진 소스 코드를 수정해선 안됩니다.**
6+
7+
**데이터**
8+
<여기에 class를 작성하세요.>
9+
10+
class Wizard {
11+
constructor(health, mana, armor) {
12+
this.health = health;
13+
this.mana = mana;
14+
this.armor = armor;
15+
}
16+
17+
attack() {
18+
console.log("파이어볼");
19+
}
20+
}
21+
22+
const x = new Wizard(545, 210, 10);
23+
console.log(x.health, x.mana, x.armor);
24+
x.attack();
25+
26+
**출력**
27+
545 210 10
28+
파이어볼
29+
*/
30+

0 commit comments

Comments
 (0)