목록전체 글 (64)
leebom
1. github에 new repository 추가 --> HTTP 경로 복사 https://github.com/leebom21/yeonstargram.git GitHub - leebom21/yeonstargram Contribute to leebom21/yeonstargram development by creating an account on GitHub. github.com 2. iterm 에서 프로젝트 경로 지정 및 프로젝트 추가 https://iterm2.com/ iTerm2 - macOS Terminal Replacement iTerm2 by George Nachman. Website by Matthew Freeman, George Nachman, and James A. Rosen. Websit..
parse() : JSON문자열 값을 JSON으로 변환하기 JSON.parse(값, 리플레이서) - 첫번째 인자는 stringify로 변환할 대상값 - 두번째 리플레이서는 JSON으로 변환하기 전에 값을 변경하는 인자. 콜백함수는 넣거나 특정 key정보를 담은 배열을 넣어 값을 변경하고 필수값은 아님. const jsonStr = '{"drama":"PET","season":2017, "casting":' + '["koyuki", "matsumoto jun"], "character":["sumire","momo"]}'; console.log(JSON.parse(jsonStr)); console.log(JSON.parse(jsonStr, (key, val) => { if (key === 'season') ..
onkeydown - 키를 눌렀을 때 이벤트 (shift, alt, controll, capslock 등의 모든 키에 동작함) onkeyup - 키를 눌렀다가 뗐을 때 이벤트 (onkeydown에서 인식하는 키를 동일하게 인식) onkeypress - 실제로 글자가 써질 때 이벤트 (shift, tap, enter 등의 특수키는 인식 못함) 남은 글자수 10
toString() : 진수 변환하기 - 일반적으로 toString 메소드는 지정된 객체의 문자열을 출력하는데 Number 객체의 toString 메소드는 값을 특정 진법으로 표현하여 문자형을 변환 const dec = 531; const binByDex = dec.toString(2); const octByDex = dec.toString(8); const hexByDex = dec.toString(16); console.log(binByDex); //1000010011 console.log(octByDex); //1023 console.log(hexByDex); //213 parseInt() - 10진수 아닌 숫자를 다른 진법으로 변환 const bin = 1000010011; const oct = ..
reverse() : 배열의 순서를 반대로 나열하기 - 배열을 반대로 나열. 함수 호출시 원본 배열도 변형되기 때문에 미리 고려해야 함 const str = 'abcdefghijklnmopqrstuvwxyz'; //split : 문자열을 배열로 변환, 공백없는 문자열''로 분할 //배열 요소에는 알파벳 한글자씩 넣어짐 const arr = str.split(''); console.log(arr); // ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "n", "m", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] //반대로 나열 arr.reverse(); //zyxwvutsrqpomn..
push() : 배열 뒤에 요소 추가하기 const festa = ['mang']; festa.push('chimmy'); festa.push('tata'); festa.push('cooky'); festa.push('shooky'); festa.push('koya'); festa.push('rj'); festa.forEach(name => { console.log(name); }) //mang //chimmy //tata //cooky //shooky //koya //rj - forEach 반복문 : 오직 Array 객체에서만 사용가능한 메서드, 배열의 요소들을 반복하여 작업을 수행 unshift() : 배열 맨 앞에 요소 추가하기 const festa = ['mang']; festa.unshift('..
> ③ substr - 문자열의 길이를 정확히 알고있는 경우 활용하기 적합 '문자열'.substr(시작인덱스, 길이) const sentence = 'Merry Christmas!!!!' console.log(sentence.substr(8)); console.log(sentence.substr(8, 7)); console.log(sentence.substr(0)); console.log(sentence.substr(-10)); //뒤에서부터 10번째 console.log(sentence.substr(0, -3)); //두번째 인자에 음수를 넣으면 정상적으로 수행하지 않음 console.log(sentence.substr(30)); console.log(sentence.substr(0, 30)); //두..
Number.isNaN : NaN 값 확인 (NaN : Not a Number) - Number 객체의 isNaN 메소드는 NaN을 구별함 - NaN 이면 true를 반환하고 아니면 false를 반환함 console.log(Number.isNaN(NaN)); // true console.log(Number.isNaN(undefined)); // false console.log(Number.isNaN('Is it Number?')); // false console.log(Number.isNaN(0)); // false console.log(Number.isNaN(null)); // false console.log(Number.isNaN(-1)); // false - 숫자형 console.log(Number..