노마드 코더 실습 코드 (8강)

yiseonline·2023년 5월 14일
0

nomadCoder

목록 보기
7/8
post-thumbnail

8.0 Geolocation

navigator.geolocation.getCurrentPosition() -> 브라우저에서 현재 위치를 준다

ㄴ success 함수는 GeolocationPosition object 하나를 입력 받음 = js가 GeolocationPosition object를 하나의 input parameter로 준다

function onGeoOk(position)
{
    console.log(position);
}
function onGeoError()
{
    alert("Can't find you. No weather for you.")
}

navigator.geolocation.getCurrentPosition(onGeoOk,onGeoError);


미친;;

latitude
: 37.320287
longitude
: 127.0945378

이런거 까지 알려줌.. ㄹㅇ 도랐다..

function onGeoOk(position)
{
    const lat = position.coords.latitude;
    const lng = position.coords.longitude;
    console.log("You live in", lat, lng);
}


ㄷㄷ


8.1 Weather API

API = 다른 서버와 이야기할 수 있는 방법


왜 난 이따구임?

여기서부터.. 아무것도 안되기 시작했다..
빡쵸서 못해먹겠음 !!!

0개의 댓글