const h1 = document.createElement("h1"); document.querySelector("body").prepend(h1); const getTime = () => { const now = new Date(); let hours = now.getHours(); let minutes = now.getMinutes(); let seconds = now.getSeconds(); hours = hours < 10 ? `0${hours}` : hours; minutes = minutes < 10 ? `0${minutes}` : minutes; seconds = seconds < 10 ? `0${seconds}` : seconds; h1.innerText = `${hours}:${minu..
const body = document.querySelector("body"); const timer = document.createElement("h2"); const title = document.createElement("h1"); body.prepend(timer); body.prepend(title); function getTime() { const target = new Date("2020-12-24 00:00:00+0900"); const today = new Date(); const gap = target - today; const d = Math.floor(gap / (1000 * 60 * 60 * 24)); // 일 const h = Math.floor((gap / (1000 * 60 ..
출처: https://unikys.tistory.com/334 // 10진수 -> 2진수 var dec = 123; var bin = dec.toString(2); // "1111011" // 10진수 -> 16진수 var dec = 123; var hex = dec.toString(16); // "7b" // 2진수 -> 10진수 var bin = "1111011"; var dec = parseInt(bin, 2); // 123 // 16진수 -> 10진수 var hex = "7b"; var dec = parseInt(hex, 16); // 123 // 2진수 -> 16진수 (* 10진수로 바꿨다가 다시 2진수로 바꾼다) var bin = "1111011"; var hex = parseInt(bin, ..