커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
웹개발 2주차 숙제 질문
undefined주차
북마크
정*훈
댓글
3
추천
0
조회수
10
조회수
10
답변 완료

2주차 숙제 중 방법을 2가지 찾았습니다. 2가지 방법 모두 정상적으로 출력은 되는데, 차이가 뭔지 모르겠습니다.


1번

        $(document).ready(function () {

            fetch("http://spartacodingclub.shop/sparta_api/weather/seoul").then(res => res.json()).then(data => {

                let number = data['temp']

                $('#temp').text(number)

            })

        })


2번


        $(document).ready(function () {

            fetch("http://spartacodingclub.shop/sparta_api/weather/seoul").then(res => res.json()).then(data => {

                let temp_html = `${data['temp']}`

                $('#temp').text(temp_html)

            })

        })




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴