프로미스는 비동기적 처리를 위한 것임..
프로미스는 코드블럭안의 다양한 일을 하고 리턴값을 반환함..
이 리턴값을 활용하는 방법...
fetch.then(response=>response.json).then(json=>{code...}) : then안에서 계속 작성... 콜백지옥...
async - await : 리턴값을 변수에 바로 할당해서 사용하려면 const a = await Promise() 이런식으로 사용해야하는데.. await는 async 함수내에서만 활용이 가능하다..
-> 방법 : 이런식으로 활용
async funtion init(){
const a = await(await fetch()).json();
}
init();