
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, ..

자바스크립트 string, number 간단하게 형변환하기 Sting()이나 parseInt() 등을 사용하지 않고 간단하게 형변환하기 // 숫자 -> 문자열 const num1 = 123456; const str1 = num2 + ""; // "123456" // 문자열 -> 숫자 const str2 = "123456"; const num2 = +str; // 123456 const num3 = str/1; // 123456 const num4 = -str; // -123456 const num5 = str/-1; // -123456

정재남 님의 인프런 강좌, JS FLOW를 참고하여 정리하였습니다. class 계급. 집단. 집합. 인스턴스: 클래스가 지닌 속성을 모두 갖고 있는 구체적인 객체 컴퓨터 상위 클래스(superclass), 하위 클래스(subclass) Constructor 안에 있는 프로퍼티와 메소드를 static properties, method 라고 한다. prototype 안에 있는 것들은 (prototype)method 라고 한다. instance에서 methods는 한 번에 접근이 가능하며 instance 자신이 this가 된다. 근데 static method, properties로는 한 방에 접근할 수 없고 this는 생성자 함수가 된다. function Person(name, age) { this._name..