티스토리 뷰
//비전공자가 혼자 공부하는 공간입니다
//잘못된 정보가 있을 수 있어요
see more ingredients를 누르면 좀 더 많은 재료를 볼 수 있는 detail.html 페이지가 열리게 만들었는데
이 둘은 구조는 거의 같은 데다가 같은 function을 쓰는 부분도 있지만
완전히 다른 function을 쓰는 부분도 있다
그래서 그런가
home.html에서 오류가 나는 것을 고치면 detail.html에서 오류가 나고
detail.html에서 오류가 나는 것을 고치면 home.html에서 오류가 난다
어찌저찌 검색해서 아래의 결론이 나왔다
아래의 함수들은 detail.html 페이지에서만 실행되도록 하는 코드
✅ location.pathname
mdn을 보면 location.pathname 을 Web APIs 로 분류하고 있는데 그러면 내가 작성한 코드가 Web API인 건지 의문이 들었고
챗지피티에게 물어보았다
Your code is not a Web API, but it is using Web APIs provided by the browser to achieve its functionality.
Web APIs are sets of methods and properties that browsers expose to allow developers to interact with the web platform. In your code snippet, the location.pathname property is a part of the Location interface, which is a Web API provided by the browser. By using location.pathname, your code is utilizing this Web API to get the path component of the URL.
So, your code is not a Web API itself, but it is using the Web APIs provided by the browser to retrieve information and interact with the web platform.
✅ Web API란
That's correct. Web APIs are not code that you write yourself, but rather pre-built interfaces provided by the browser that you can use in your own code.
웹 API는 사용자가 직접 작성하는 코드가 아니라 브라우저에서 제공하는 사전 구축된 인터페이스로 사용자 자신의 코드에서 사용할 수 있습니다. (이거 하나만 기억하면 될 것 같다)
When you use Web APIs, you are essentially calling pre-existing functionality that has been built into the browser. This can include things like window.alert(), XMLHttpRequest, and localStorage, among many others.
To use these Web APIs, you typically just need to call them in your JavaScript code, as you would with any other function or method. The browser then handles the underlying functionality for you, allowing you to use these APIs to interact with the web platform in various ways.
API를 막연히 데이터를 주고 받기 위한 방법, 통신 방법 혹은 대화 방법? 대화 규격 같은 추상적인 개념으로만 알고 있었는데
체감상 조금 더 이해가 되는 것 같다
깨끗한 콘솔창을 보니까 기분이 좋구만
하지만 아직 고칠 게 많이 남았다..... 내 struggling은 to be continued....
//비전공자가 혼자 공부하는 공간입니다
//잘못된 정보가 있을 수 있어요
'포트폴리오' 카테고리의 다른 글
[디버깅] 체크박스 Input & Label 불일치 오류 고치기 (0) | 2023.03.08 |
---|---|
checkbox hover기능 + 컬러 변경 (0) | 2023.02.27 |
DOMContentLoaded 사용해서 오류 해결하기 (0) | 2023.02.14 |
chatGPT 사용해서 오류 고쳐보기 (0) | 2023.02.05 |
체크된 항목 리스트 표시 + 스택오버플로우 질문하기 (0) | 2023.01.31 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 캐시오류
- 변수스코프
- CSS
- dom조작
- DOM제어
- translateX
- 비전공자
- VirtualDom
- 프론트엔드독학
- 리액트
- DOM자바스크립트
- 체크박스오류
- 자바스크립트
- 논리부정연산자
- 프로그래밍독학
- 코딩독학
- CSS선택자
- 즉시실행함수
- 가상돔
- CSS게임
- 이벤트핸들링
- :nth-child
- labelfor
- DOMapi
- vanillajs
- JavaScript
- 화살표함수
- 로컬스토리지오류
- 상태변수
- CSSDiner
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
글 보관함