목록js (26)
솔미는 성장중

.toFixed() 숫자를 지정된 고정 소수점 표기(자릿수)까지 표현하는 문자로 반환 (입력받은 숫자 개수 만큼 소수점 자리 남기고 반올림된다) .toLocaleString() 숫자를 현지 언어 형식의 문자로 반환 Number.isInteger() Number라는 클래스에 바로 붙어있는 isInteger는 정적 메소드 숫자가 정수인지 확인 (boolean 값으로 반환) Number.isNaN() 주어진 값이 'NaN'인지 확인 (boolean값으로 반환) Number.parseInt() 또는 parseInt() 주어진 숫자, 문자 값을 파싱해 특정 진수의 정수로 반환 아래 예시는 십진수. Number.parstFloat() 또는 parseFloat() 주어진 숫자, 문자 값을 파싱해 부동소수점 실수로 반..

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length String: length - JavaScript | MDN The length data property of a String value contains the length of the string in UTF-16 code units. developer.mozilla.org str.length 대상 문자의 길이를 숫자로 반환 str.includes('문자') 대상 문자에 주어진 문자가 포험되어있는지 확인. boolean값으로 반환 str.includes('문자',숫자) 숫자 번 째부터 판단 str.indexOf('문자') - 대상 문자..
colors.test() 배열 만드는 방법 1. 리터럴 방식으로 배열 만들기 const colors = ['Red', 'Green', 'Yellow', 'Blue'] 2. 생성자 함수 형식으로 배열 만들기 (new사용) const colors = new Array('Red', 'Green', 'Yellow', 'Blue') console.log(colors) //(4) ['Red', 'Green', 'Yellow', 'Blue'] //0: "Red" //1: "Green" //2: "Yellow" //3: "Blue" console.log(colors.includes('Green')) //true console.log(colors.length) //4 여기서 length, includes를 prototy..
메소드(객체 내 함수) this -> 객체 함수 this -> window object constructor function this -> 빈 객체를 가리킴 (여기다가 속성을 넣는거) 화살표 함수 this -> 상위 스코프 this 일반 함수의 this : 호출 위치에서 정의 : 아래 예제에서 this → PPAP로 바꿔주어도 결과가 동일 : 즉! this = getFullName이라는 속성이 들어있는 객체 데이터 const PPAP = { front: 'PenPineapple', end: 'ApplePen', getFullName: function() { return `${this.front} ${this.end}` } } console.log(PPAP.getFullName()) //PenPineapp..
기본 개념 setTimeout (실행할 내용, 시간) '시간' 후에 1번 실행 실행할 내용 적는 방법 () => {내용} 함수명 clearTimeout (대상) 타이머를 해제한다. setInterval (실행할 내용, 시간) '시간'마다 실행 clearInterval (대상) setInterval로 실행하던 것 해제 예제 [index.html] Click Me [main.js] const HelloWorld = () => { console.log('HelloWorld!') } const timeout = setInterval(HelloWorld,1000) const h1El = document.querySelector('h1') h1El.addEventListener('click',()=>{ consol..