첫 JavaScript 실습 예제 (o´〰`o)♡✲゚。
index.html
<div class = "js-clock">
<h1>00:00</h1>
</div>
<script src="clock.js"></script>
Q1.
const clockContainer = document.querySelector('.js-clock');
const clockTitle = clockContainer.querySelector('h1');
Can we directly go for clockTitle = document.querySelector("h1"); instead of making const clockContainer? Yes!
He use clockContainer.querySelector("h1") because he think document.querySelector("h1") is too general and maybe I might have another h1 on the document.
new Date() 함수
ternary operator (or mini if)
${second < 10 ? 0${seconds} : seconds}
setInterval(function, howOftenTheFunctionShouldExecute)