promise란?

제작 코드 + 소비 코드를 연결해 주는 자바스크립트 객체 입니다.

let promise = new Promise(function(resolve, reject) {
	// executor (실행 함수로 new Promise가 만들어질 때 자동으로 실행된다.)
}

then, catch, finally

then

promise.then(
	function(result) {/* result를 다룹니다. */}
	// 프라미스가 이행되었을 때 실행되며 실행 결과를 받습니다.
	function(error) {/* erro를 다룹니다. */}
	// 프라미스가 거부되었을 때 실행되며 에러를 받습니다.
);

catch

에러만 발생한 경우를 다루고 싶다면 catch를 사용할수있습니다. .then(null, errorHandlingFunction)과 동일하게 작동합니다.

finally