Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 백준 1339번 자바스크립트
- 자바스크립트 스코프
- emotion RSC
- js
- 스코프
- suspense 동작원리
- suspense 병목현상
- 구름톤
- TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more:
- 사용성 개선
- app router emotion
- js 문자열 압축
- 구름톤 챌린지 회고
- 백준 2108 자바스크립트
- suspense 비동기
- js 스코프
- 백준 1339번 nodejs
- 옵셔널체이닝
- 구름톤 챌린지
- suspense react-query
- next13 emotion
- 자바스크립트 문자열 압축
- js 거리두기 확인하기
- 카카오 코테
- 백준 1339번 js
- 리액트쿼리 suspense
- emtion app router
- 프로그래머스 문자열 압축
- 프로그래머스 거리두기 확인하기
- 백준 2108 nodejs
Archives
- Today
- Total
목록일반함수 화살표함수 (1)
Lennon FE
[JavaScript] 화살표 함수와 일반 함수의 차이
자바스크립트에서 일반 함수는 함수를 선언할 때 this에 바인딩할 객체가 동적으로 결정된다. 아래 함수가 어떻게 실행될 지 예상해보자. const obj = { name: 'minho', intro: function() { console.log(this.name) setTimeout(function() { console.log(this.name) }, 1000) } } obj.intro() 논리적으로 생각해보면 당연히 minho가 두 번 뜰거라 생각한다. 그러나 두 번째 console.log는 undefined가 뜨는 걸 확인할 수 있다. 이유는 무엇일까? setTimeout 내부의 this는 window를 가르키기 때문이다. 해당 문제를 아래 코드와 같이 bind, call, apply를 통해 어디에 ..
🧑💻 Web/JavaScript
2022. 6. 3. 15:39