노마드 코더의 초보자를 위한 바닐라 자바스크립트
https://www.youtube.com/watch?v=lXxlGCRBOQU&list=PL7jH19IHhOLM8YwJMTa3UkXZN-LldYnyK&index=24
so.. What function do we need on this website
<div class="js-clock"></div>
- Set variables as **const** ALWAYS(he never use *var*)
### 1.1 Set classname for applying function
```html
<div class="js-clock">
<h1 class="js-title">00:00</h1>
const clockContainer = document.querySelector(".js-clock"),
clockTitle = clockContainer.querySelector(".js-title");
function getTime () {
const date= new Date();
const hours = date.getHours();
const minutes = date.getMinutes();
const seconds= date.getSeconds();
clockTitle.innerText = `${hours}:${minutes}:${seconds}`
}
function init(){
gettime();}
init();
function init(){
gettime();
setInterval(getTime,1000);
}
function getTime () {
const date= new Date();
const hour = date.getHours();
const minute = date.getMinutes();
const seconds= date.getSeconds();
clockTitle.innerText=`${hour<10 ? `0${hour}`: hour}:${minute<10 ? `0${minute}` : minute}:${seconds<10 ? `0${seconds}` : seconds}`
}
notes from April 25th 2020, will check more of the basics and come back to complete the following.(I PROMISE...)