Console.dir이 뭘까?
https://developer.mozilla.org/en-US/docs/Web/API/console/dir
console: dir() method - Web APIs | MDN
The method console.dir() displays an interactive list of the properties of the specified JavaScript object. The output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects.
developer.mozilla.org
먼저 공식문서를 첨부했다.
그 이후는 내가 이해한 내용을 쉽게 풀어내려고 한다.
dom으로 불러낸 요소의 속성으로 display:none을 주고 싶었는데 자꾸 작동이 되지 않아서 헤메고 있었다.
찾아보니 display 속성으로 flex를 쓰고 있어서 안 되는거였지만
작동이 되지 않는 다는 것을 직접 눈으로 확인할 수 있는 방법을 찾아서 이렇게 글을 써본다.
console.dir은 console.log와 비슷하게 생긴 것 처럼 똑같이 콘솔 창에 값을 보여준다.
이 둘의 차이점은 console.dir은 괄호 안에 들어간 요소의 속성값을 보여준다
콘솔 창에 console.dir을 치면
이렇게 아주 길게 속성의 목록들이 나온다.
스크롤을 내려야할 정도로 아주 길게 나온다.
원하는 속성을 찾아 값이 들어갔는지 확인해보면 될 것 같다.