Skip to content

Instantly share code, notes, and snippets.

@pihamchi
pihamchi / asyncAwaitExample.js
Created June 16, 2022 07:35
async/await 에 대한 필요성을 굳이 마련하기 위한 자리 입니다.
/*
function 사용자이름정보출력하기() { //
var user = 사용자id로정보조회(api);
if (user.id === 1) {
console.log(user.name);
}
}
*/
async function 사용자이름정보출력하기() {
@pihamchi
pihamchi / async2.js
Created June 16, 2022 07:07
콜백지옥 수도코드 예시
$.get('url', function(response) {
자리를리턴하는함수(response, function(id) {
앉았는지를확인하는함수 (id, function(result) { //
음식을리턴하는함수(result, function(text) {
console.log(text);
});
});
});
});
@pihamchi
pihamchi / async1.js
Created June 16, 2022 06:57
비동기 처리 예제
// https://joshua1988.github.io/web-development/javascript/javascript-asynchronous-operation/
// #1
console.log('Hello');
// #2
setTimeout(function() {
console.log('Bye');
}, 3000);
// #3
console.log('Hello Again');