Skip to content

Instantly share code, notes, and snippets.

@ohoroyoi
Created July 13, 2019 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohoroyoi/ddbd0a49fad25ee3f4f68610728dcbf0 to your computer and use it in GitHub Desktop.
Save ohoroyoi/ddbd0a49fad25ee3f4f68610728dcbf0 to your computer and use it in GitHub Desktop.
이렇게 하면 순서가 어떻게 출력이 될까요?
const getTodos = (id) => {
return new Promise((resolve, reject) => {
$.getJSON(`https://jsonplaceholder.typicode.com/todos/${id}`, (data) => {
resolve(data);
console.log(data);
});
});
}
// // 아래처럼 하면 순서보장 x
getTodos('1');
getTodos('2');
getTodos('3');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment