Async - Await 역시 Promise와 마찬가지로 비동기 작업. 다만 비동기 작업인데도 불구하고 코드가 밑으로 순차적으로 보이게할 수 있어 좋은 점이다. async function 함수이름( ){ } const 함수이름 = async( ) => { } function p(ms){ return new Promise((resolve, reject) =>{ resolve(ms); }, ms) }); } // Promise 객체를 이용해서 비동기 로직을 수행할 때 p(1000).then(ms => { console.log('${ms} ms 후에 실행!'); }); // Promise 객체를 리턴하는 함수를 await로 호출하는 방법 const ms = await p(1000); // resolve때 넣은..
/* ES6 표준 내장 객체로 추가 */ Promise 비동기적인 상황에 코드를 명확하고 실행하도록 한다. console.log(Promise); // [Funtion: Promise] /* 생성자를 통해서 프로미스 객체를 만들 수 있다. 생성자의 인자로 executor라는 함수를 이용한다. resolve와 reject는 함수. (resolve, reject) -> {...} */ new Promise(/* executor */) -> new Promise((resolve, reject) =>{ resolve( ); // fulfilled 이행된 상태. reject( ); // rejected 거부된 상태. }); new Promise(executor) // pending state resolve // ..
es6 클래스 { ... } } or // 크롬 12버전 이후 (런타임문제) class B{ name; age; } // get, set class A{ _name = 'value'; get name( ){ return this.name + '@@@'; } set name(value){ this.name = value + '!!!' ; } } const a = new A( ); console.log(a); a.name = 'Mark'; console.log(a); // A { _name: 'value' } console.log(a.name) // Mark!!!@@@ console.log(a._name)// Mark!!! //readonly class B{ _name = 'value'; get name( ..
// 생성자, 왠만하면 애로우 함수를 쓰지말자(범위 문제가 있음) function A(){ } const a = new A( ); console.log(a, type of a) // A { } 'object' console.log(A( )) // undefined function B(name){ console.log(name); } const b = new B('mark'); // mark // 객체에 속성 추가하기 function A(name){ this.name = name; } const a = new A('mark'); console.log(a); // A{name : 'mark'} //함수를 속성으로 넣기 function B( ){ this.hello = function(){ console.lo..
for, do while, while 등.. js에서의 특이 반복문 : // for of for(const i of [1, 2 ,3]){ console.log(i); => // 1,2,3 출력 } // for in Object.prototype.test = function(){}; for(const i in {a : 1, b : 2, c:3}){ console.log(i); => // a,b,c, test(?) 출력 => 조심해서 사용하자! } 함수) //선언적 function function hello1(){ console.log('hello1'); } console.log(hello1, type of hello1); // [Function : hello1], 'function' // 매개변수와 함수 ..
let : 변수 선언 => undefined, (한번만 선언 가능) false
- Total
- Today
- Yesterday
- Co
- https://react.vlpt.us/basic/11-render-array.html
- https://wikidocs.net/68
- https://react.vlpt.us/
- ㄴ
- https://velog.io/@juno7803/React%EA%B0%80-%ED%83%9C%EC%96%B4%EB%82%9C-%EB%B0%B0%EA%B2%BD
- https://subicura.com/2017/01/19/docker-guide-for-beginners-1.html
- https://jwprogramming.tistory.com/52
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |