Callback Funtion

<aside> 🍏 콜백 함수를 인자로 받은 함수가 모든 작업을 끝내면 비로소 호출됨

</aside>

function sleep(ms) {
	const wakeUpTime = Date.now() + ms;
	while (Date.now() < wakeUpTime) { }
}

var a = function () {
	console.log('A');
}

function slowFunc(callback) {
	sleep(3000);
	callback();
}

slowFunc(a);

익명 함수

var a = function () {
	console.log('A');
}