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
- NoSQL
- React Component
- NPM
- 클래스컴포넌트
- express-generator
- 리액트
- 리액트스타디
- 리액트기초
- component
- 시퀄라이즈공부
- sequelize
- MongoDB
- sementicversion
- nodejs교과서
- 리액트컴포넌트
- React
- node
- 제로초예제
- 시퀄라이즈
- mongoose
- nodeJS
- npm명령어
- mongo
Archives
- Today
- Total
개발노트
ES6 본문
hooks 문법
created : function(){}
created (){ }
화살표함수 this차이점
js는 기본적으로 전역변수로 시작하는데, 변수선언하면 최상단 브라우저객체인window에 담아짐
(1) this 도 이 window를 가리키고
(2) function내의 this 도 전역this임
function sum(a, b){
console.log(this);
return a+b;
}
const sum = (a,b)=> { console.log(this); return a+b };
>>undefined
(3) 생성자로 생성하는 함수의 this
function Vue(el){
console.log(this);
this.el = el;
}
new Vue('#app');
(4) 비동기 처리의 this
비동기호출전 this->window
호출후-> 기존this에서 벗어난 this가 생김 undefined
(그래서 비동기호출함수 외부의 this를 가져다가 연결해서 사용했음)
ES6로 호출후-> 호출되는위치의 this를가져옴
(가져올필요없음 !)
use strcit
developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Strict_mode