반응형
Notice
Recent Posts
Recent Comments
Link
반응형
목록객체 (1)
반응형
taenyLog
[JavaScript] Arrow Function and 'this'
const person = { firstName : 'Taeny', lastName : 'Kim', fullName : function(){ `${this.firstName} ${this.lastName}` } } 여기서 this가 person을 가르키니까 Taeny Kim의 값을 얻을 수 있다. const person = { firstName : 'Taeny', lastName : 'Kim', fullName : function() => { `${this.firstName} ${this.lastName}` } } 화살표 함수 안에 있는 this 키워드는 함수가 만든 범위를 가리킨다. 즉, 윈도우 객체를 가리킨다. const person = { firstName : 'Taeny', lastName : '..
Web
2023. 9. 26. 09:17