노마드코더 바닐라 JS강의 완강!(마지막 과제만 제출하면 끝이다!)

위의 강의 보면서 이전에 구현해보던 todo 왜 안되는지 이유 찾았음
fetch로 날씨 api 가져오기 해봄
유클리드 호제법
랄 것도 거의 없네 그냥 의식의 흐름대로 적어본다...
const API_KEY = ""; // 내 API 키라서 지웠음
function onGeoOk(position) {
const lat = position.coords.latitude;
const lon = position.coords.longitude;
const url = `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=${API_KEY}&units=metric`;
fetch(url) //
.then((response) => response.json())
.then((data) => {
const weather = document.querySelector("#weather span:first-child");
const city = document.querySelector("#weather span:last-child");
city.innerText = data.name;
weather.innerText = `${data.weather[0].main} / ${data.main.temp}`;
});
}
function onGeoError() {
alert("Can't find you. No weather for you.");
}
navigator.geolocation.getCurrentPosition(onGeoOk, onGeoError);
바로 어제 프로미스 공부하면서 봤던 then 친구가 등장했다.
이건 다음 글에서 나름대로 정리해놔서 링크만 올리고 패스!
유클리드 호제법
오늘...딴 짓 안하고 아침부터 공부만 했는데 뭔가 아웃풋은 별로 없는 느낌이다 흑흑흑....이상하네ㅜㅜ
슬슬 리액트 공부도 깔짝여 볼까~? 하면 모르는 게 튀어나온다....
기본도 잘 못하면서 무슨 리액트니.... 자바스크립트부터 확실하게 기반을 다지기로 맘 먹었다.
암튼 오늘도 열심히 살았다 굿... 자야지