Seop_E [Frontend Study]
close
프로필 배경
프로필 로고

Seop_E [Frontend Study]

  • 분류 전체보기
    • HTML - CSS
    • JS
    • React
    • Git
    • How to(w3 study)
    • BootCamp Review
    • 기타
  • 홈
  • GitHub

(5) ~ (13) Promise 정리

보호되어 있는 글입니다.

  • format_list_bulleted JS
  • · 2025. 1. 28.
(13) Asynchronous JavaScript - Promise.all() 메소드

(13) Asynchronous JavaScript - Promise.all() 메소드

이때까지 하나의 Promise 객체를 다루기 위해 알아야 하기 위해 공부했다.하지만 실무 개발에서는 여러 개의 Promise 객체를 다뤄야 할 일도 종종 발생하는데,이번에는 여러 개의 Promise 객체를 다뤄보는 Promise.all 메소드에 대해 araboza.Promise.all다음과같이 id 638번부터 642번에 해당하는 데이터를 받아와서 출력하는 코드가 있다. // main.js async function printList(id) { const response = await fetch(`https://todo-api.fesp.shop/api/todolist/${id}`) const data = await response.json(); console.log(data); ..

  • format_list_bulleted JS
  • · 2025. 1. 27.
  • textsms
(12) Asynchronous JavaScript - catch(), finally() 메소드

(12) Asynchronous JavaScript - catch(), finally() 메소드

// mainfetch('https://todo-api.fesp.shop/api/todolist') .then((response)=> response.json()) .then((data)=> console.log(data)); console.log('Task 2'); console.log('Task 3');then 메소드와 프로미스 체인(Promise Chain)을 사용할 때는아래와 같이 catch와 finally 메소드를 사용할 수 있다.// mainfetch('https://todo-api.fesp.shop/api/todolist') .then((response)=> response.json()) .then((data)=> console.log(data)) .ca..

  • format_list_bulleted JS
  • · 2025. 1. 23.
  • textsms
(11) Asynchronous JavaScript - then() 메소드

(11) Asynchronous JavaScript - then() 메소드

Promise를 다루는 방법에 대해 두 가지가 있다고 했을 떄,https://seop-e.tistory.com/209 (6) Asynchronous JavaScript - Promies 다루는 방법Promise 다루는 방법은 크게 두가지 있다.async 함수와 await 문법then() 메소드 + Callback먼저 async 함수와 await 문법을 다뤄보자await 문법fetch 함수는 Promise 객체를 리턴한다고 했을 때비동기 작업이 완seop-e.tistory.comasync 함수와 await 문법then() 메소드 + Callbackthen 메소드를 이용해서 Promise를 다뤄보자.then() 메소드자바스크립트에서 비동기 코드를 잘 활용하려면async, await, then 전부 다 알고 ..

  • format_list_bulleted JS
  • · 2025. 1. 10.
  • textsms
(10) Asynchronous JavaScript - Promise와 오류

(10) Asynchronous JavaScript - Promise와 오류

// asyncFunction.jsexport async function printList () { try{ const response = await fetch('https://todo-api.fesp.shopppppppp/api/todolist'); const data = await response.json() console.log(data); } catch (error) { console.log('에러가 발생했습니다.'); // console.log(error); return; } finally { console.log('Finished'); }}위 비동기 코드에서 오류가 나면  try문이 오류를 잡아서 catch문이 실행된다고 했을 때상황을 좀 더 객관적..

  • format_list_bulleted JS
  • · 2025. 1. 9.
  • textsms
(9) Asynchronous JavaScript - try catch로 비동기 오류 처리

(9) Asynchronous JavaScript - try catch로 비동기 오류 처리

▶asyncFunction.js, main.js 파일더보기// asyncFunction.jsexport async function printList () { const response = await fetch('https://todo-api.fesp.shop/api/todolist'); const data = await response.json() console.log(data);}// main.jsimport {printList} from './asyncFunction.js';printList()이전 글 들을 포함해서 여태 비동기 작업이 항상 오류 없이 잘 실행된다고 가정하고 코드를 구성하였는데만약 비동기 작업이 실패할 경우가 생기는 경우그러니까 예를들면 다음과 같은 상황이 생길 때,fetch는 ..

  • format_list_bulleted JS
  • · 2025. 1. 7.
  • textsms
  • navigate_before
  • 1
  • ···
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • ···
  • 40
  • navigate_next
공지사항
전체 카테고리
  • 분류 전체보기
    • HTML - CSS
    • JS
    • React
    • Git
    • How to(w3 study)
    • BootCamp Review
    • 기타
최근 글
인기 글
최근 댓글
태그
  • #javascript
  • #react
  • #오블완
  • #CSS
  • #W3Schools
  • #js
  • #티스토리챌린지
  • #html
  • #Sass
전체 방문자
오늘
어제
전체
Copyright © 쭈미로운 생활 All rights reserved.
Designed by JJuum

티스토리툴바