<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
class Human {
constructor(name, age, weight) {
this.name = name;
this.age = age;
this.weight = weight;
};
eat() {
this.weight++;
};
sleep = () => {
this.age++;
};
}
const man = new Human('kim', 10, 70);
man.eat();
man.sleep();
console.log(man);
</script>
</body>
</html>
그냥 메서드 eat이랑 화살표함수로 쓴 sleep이랑 왜 둘다 this가 Human임?
증가하는디
ㅇㅇ 증가하는데 내가 궁금한거는 클래스안에서 그냥 함수선언문으로 쓴 메서드랑 화살표함수로 쓴 메서드랑 왜 둘다 this가 Human인건지