this키워드1 this키워드와 slice() JavaScript Objects An object method is a function definition, stored as a property value. this는 객체의 주인을 가리킨다. 위의 코드에서 fullName이라는 프로퍼티의 함수를 보면 this를 쓴 것을 알수 있는데, 여기서 this는 객체 주인을 가리킨다 즉, person이라는 객체를 가리킨다. fullName:function(){ return this.firstName+ " " + this.lastName; } 근데 , this 함수가 return과 같이 쓰인다면 그 객체가 아니라 return 함수에 들어있는 객체를 신경써야 한다. 다음의 경우 this.name이 undefined로 나왔는데, return 함수에 객체가 하나도 없.. 2023. 2. 7. 이전 1 다음