Code States
Front-end boost camp
Today
I
Learned
🐬 5월 12일 금요일 23일차 수업 시작
오늘은 어제 배운 클래스, 프로토타입 이론 공부(링크: https://bit.ly/3pwV3V1)에 이어 오늘은 클래스와 프로토타입을 익혀볼 수 있는 페어 과제를 진해했다. 난이도는 어렵진 않았다.!
1) Grub class functionality - 완료
✓ age
속성은 0
이어야 합니다
✓ color
속성은 pink
이어야 합니다
✓ food
속성은 jelly
이어야 합니다
✓ eat
메서드가 존재해야 합니다
✓ eat
메서드는 Mmmmmmmmm jelly
를 리턴합니다.
class Grub {
// TODO..
}
module.exports = Grub;
class Grub {
// TODO..
constructor (age, color, food) {
this.age = 0;
this.color = 'pink';
this.food = 'jelly';
}
eat() {
return 'Mmmmmmmmm jelly';
}
}
module.exports = Grub;
2) Bee class functionality
✓ age
속성은 5
이어야 합니다
✓ color
속성은 yellow
이어야 합니다
✓ food
속성은 Grub으로부터 상속받습니다
✓ eat
메서드는 Grub으로부터 상속받습니다
✓ job
속성은 Keep on growing
이어야 합니다
const Grub = require('./1-Grub');
class Bee {
// TODO..
}
module.exports = Bee;
const Grub = require('./1-Grub');
class Bee extends Grub {
// TODO..
constructor (age, color, job) {
super();
this.age = 5;
this.color = "yellow";
this.job = "Keep on growing";
}
}
module.exports = Bee;
3) ForagerBee class functionality
✓ age
속성은 10
이어야 합니다
✓ job
속성은 find pollen
이어야 합니다
✓ color
속성은 Bee
로부터 상속받습니다
✓ food
속성은 Grub
으로부터 상속받습니다
✓ eat
메서드는 Grub
으로부터 상속받습니다
✓ canFly
속성은 true
이어야 합니다
✓ treasureChest
속성은 빈 배열 []
이어야 합니다
✓ forage
메서드를 통해 treasureChest
속성에 보물을 추가할 수 있어야 합니다
const Bee = require('./2-Bee');
class ForagerBee {
// TODO..
}
module.exports = ForagerBee;
const Bee = require('./2-Bee');
class ForagerBee extends Bee {
// TODO..
constructor (age, job, canFly, treasureChest) {
super();
this.age = 10;
this.job = 'find pollen';
this.canFly = true;
this.treasureChest = [];
}
forage(treasure) {
this.treasureChest.push(treasure);
}
}
module.exports = ForagerBee;
4) HoneyMakerBee class functionality
✓ age
속성은 10
이어야 합니다
✓ job
속성은 make honey
이어야 합니다
✓ color
속성은 Bee
로부터 상속받습니다
✓ food
속성은 Grub
으로부터 상속받습니다
✓ eat
메서드는 Grub
으로부터 상속받습니다
✓ honeyPot
속성은 0
이어야 합니다
✓ makeHoney
메서드는 honeyPot
에 1씩 추가합니다
✓ giveHoney
메서드는 honeyPot
에 1씩 뺍니다
const Bee = require('./2-Bee');
class HoneyMakerBee {
// TODO..
}
module.exports = HoneyMakerBee;
const Bee = require('./2-Bee');
class HoneyMakerBee extends Bee {
// TODO..
constructor (age, job, honeyPot) {
super();
this.age = 10;
this.job = 'make honey';
this.honeyPot = 0;
}
makeHoney() {
this.honeyPot = this.honeyPot + 1;
}
giveHoney() {
this.honeyPot = this.honeyPot - 1;
}
}
module.exports = HoneyMakerBee;
오늘 과제는 어렵지 않아서 괜찮았다! 주말간 할일... 기술면접 답변 마무리/ git 공부/ 고차함수 못 다 푼 문제 풀기/ class 문제 찾아서 풀기