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 |
Tags
- 시퀄라이즈
- mongo
- 리액트컴포넌트
- 리액트
- NoSQL
- sementicversion
- 리액트스타디
- node
- 리액트기초
- MongoDB
- NPM
- sequelize
- component
- nodejs교과서
- nodeJS
- React
- npm명령어
- 시퀄라이즈공부
- React Component
- mongoose
- 클래스컴포넌트
- 제로초예제
- express-generator
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
Strict mode - JavaScript | MDN
Strict mode 가끔 엄격하지 않은 기본값을 "느슨한 모드(sloppy mode)"라고 부르기도 합니다. 공식적인 용어는 아니지만 혹시 모르니 알아두세요. ECMAScript 5 에서 소개된 JavaScript 의 엄격모드는 JavaScrip
developer.mozilla.org