일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- 햇소
- JS
- hatso
- Python
- es6
- DOM
- 변수
- 함수
- next.js
- ChatGPT
- JavaScript
- git
- 선택자
- 우아한테코톡
- ES6+
- hooks
- github
- This
- object
- CSS
- gitCLI
- 최적화
- API
- ES5+
- dev
- react
- html5
- AI
- array
- learn next.js
Archives
- Today
- Total
목록BIND (1)
codinghatso

"javascript에서 this는 함수를 호출한 객체이다" 전역에서 this 호출 시 window객체를 가리킨다. function main(){ console.log(this); } main(); //와 window.main()은 같다. //window객체를 가리킨다. 'use strict'를 사용하면 함수를 호출한 객체를 명시하지 않으면 undefined 값을 반환한다. const object = { name: 'hatso', main: function() { console.log(this); }, }; object.main(); //이렇게 하면 main함수를 호출한 object객체를 this가 가리킨다. //만약 const main2 = object.main; //main2(); //이렇게 호출한다..
WEB/JavaScript
2023. 10. 21. 19:41