전체 글 37

Node.js 개념

Node.jsnvm은 node.js 매니저라고 생각하면 된다.google에 nvm 검색 후 Git 링크로 접속 > installing and updating 에 공유된 코드 중 첫번째 'curl -o- https://~' 로 시작되는 코드 복사해서 터미널에서 설치vs code 의 터미널에서nvm ls : nvm list 확인nvm install 12.14.1 : 12.14.1 버전 확인nvm use 12.14.1 : 12.14.1 버전 사용node --version : node 버전 확인nvm uninstall 12.21.1 : 12.21.1 버전 삭제nvm --help : 설명서npm은 node.js의 패키지 매니저 (node.js 설치하면 자동 설치)vs code 의 터미널에서npm init -y :..

JavaScript 함수

화살표 함수() => vs function () {}const double = function (x, y) { return x * 2}console.log('double: ', double(7))const doubleArrow = x => x * 2console.log('doubleArrow: ', doubleArrow(7))const name = x => ({name: 'Heropy'}) 즉시 실행 함수IIFE, Immediately-Invoked Function Expressionconst a = 7function double() { console.log(a * 2)}double();(function () { console.log(a * 2)})();// 강사님은 이 방법 더 추천(functio..

JavaScript 조건문

조건문 (If statement)const a = random()if(a ===0) { console.log('a is 0')} else if (a ===2) { console.log('a is 2')} else { console.log('rest...')} 조건문 (Switch)If의 조건이 특정한 값으로 딱 떨어질 때는 switch문으로 직관적인 코딩이 가능하다.하나의 케이스 다음에는 break로 막아줘야 한다.마지막 default(else 개념)에는 break 불필요 switch (a) { case 0: console.log('a is 0') break case 2: console.log('a is 2') break case 4: console.log('a is..

JavaScript 연산자

산술 연산자 (arighmetic operator)console.log(1 + 2) // 더하기console.log(3 * 4) // 곱하기console.log(10 / 2) // 나누기console.log(7 % 5) // 나머지 할당 연산자 (assignment operator)const a = 2let b = 2// b = b + 1b += 1console.log(b) //3 비교 연산자(comparision operator)const c = 1const d = 1console.log(c === d) // truefunction isEqual(x, y) { return x === y}console.log(isEqual(1, 1));console.log(isEqual(2, '2'));const e ..

Node.js를 사용하여 Error: Cannot find module '<module name>' 오류 해결 방법

Git 레파지토리에서 clone이 아닌 zip 파일을 다운로드 받아서vs code 에서 npm install 하려고 했더니 생겼던 오류  node의 버전은 잘 나오는데 npm의 버전을 확인하니 동일한 오류가 나온다.  버전 확인 명령을 실행할 때도 동일한 오류가 발생한다면, npm 또는 Node.js 설치에 문제가 있을 가능성이 높다.이 경우, Node.js와 npm을 완전히 제거한 후 다시 설치하는 것이 도움이 될 수 있다.  그래서 제거하기 위해 작성한 명령어nvm uninstall 12.14.1 ⬇️ 하지만 이래도 현재 활성화된 Node.js 버전을 제거하려고 할 때 발생하는 오류가 나온다.이 문제를 해결하기 위해 다른 버전을 설치하고 활성화한 다음 현재 활성화된 버전을 제거해야 한다. 문제해결 단..

JavaScript 함수 개념 정리

// Object(객체 데이터)// 여러 데이터를 Key:Value 형태로 저장합니다.let user = { name:'wonji', age:27, isValid:true};// 호출console.log(user.name); // wonjiconsole.log(user.age); // 27console.log(user.isValid); // true // let: 값(데이터)의 재할당let a = 12;console.log(a); //12a = 999;console.log(a); //TypeError: Assignment to constant variable.// const: 값(데이터)의 재할당 불가!const b = 12;console.log(b); //12b = 999;console.log(b..

CSS 선택자 정리

강의를 듣다가 기존에 알던 CSS 선택자 외에 알게 된 다른 복합 선택자들  ORANGE CHERRY KIWI MELON PLUM  이러한 태그 구조가 있다고 가정해볼 때, * 은 모든 태그를 선택하는 선택자로 이 상황에서는 .fruits 안에 있는 모든 태그(= 모든 li 태그)를 선택하게 되어 다음과 같은 결과가 나온다. .fruits *:nth-child(2n) {color:rgb(79, 111, 208);} 2n에서 n은 0부터 시작하는 숫자이다.2n은 2x0, 2x1, 2x2, 2x3 ... 으로 해당 코드는.fruits 안에 있는 자식 태그 중에 0번째, 2번째, 4번째 ... 태그를 선..