TIL 12.30 - Code Camp 3주 - 5일차

박선우·2022년 12월 29일
0

code_camp

목록 보기
15/31
post-thumbnail

3주 - 5일차 code camp

  1. Javascript

1 API
1-1 http
1-2 API 메서드

2 동기, 비동기 : js는 동기적으로 실행된다
2-1
stack(LIFO) : 나중에 들어온 코드가 먼저 실행,
queue(FIFO) : 들어온 순서대로 코드가 실행

3 Promise

then
- promise 상태값 반환
catch
- err 값 반환
const weatherSearch = ({ latitude, longitude }) => {
    fetch(
        `https://api.openweathermap.org/data/2.5/weather?lat=${latitude}&lon=${longitude}&appid=e6972d059e9ad66dbd18b9b5403f8500`
    )
        .then((res) => {
            return res.json();
        })
        .then((json) => {
            const weatherData = {
                location: json.name,
                weather: json.weather[0].main,
            };
            weatherDataActive(weatherData);
        })
        .catch((err) => {
            console.error(err);
        });
};

4 구조분해할당

4-1 spead 연산자

5 얕은 복사, 깊은 복사

과제

  • 과제
  • 3주 - 5일차 과제 = javascript
profile
코린이 열심히 배우자!

0개의 댓글