pwd : print working directory의 약자로, 현재 위치하고 있는 경로를 표시해준다.
mkdir : make directories의 약자로, 해당 경로에 폴더를 만들어 준다. ex) mkdir helloWorld
li : list의 약자로 현재 위치하고 있는 곳의 폴더들을 리스트로 표시해준다.
open . : 현재 위치한 경로를 폴더로 열어준다.
cd : change directory의 약자로, 경로로 진입해준다. ex)cd helloWorld
touch : 파일을 생성해준다. ex) touch hello.txt
cat : 파일을 터미널에서 실행시켜준다.ex) cat hello.txt
sudo : 사용자 환경에서, 관리자 권한을 획득한다.
rm : remove의 약자로, 파일을 삭제한다.(휴지통으로 가지 않음) ex) rm hello.txt(파일 삭제) , rm -rf hello (폴더삭제)
mv : move의 약자로, 파일이나 폴더를 이동시킨다. ex)mv hello.txt hi (hello.txt를 hi 폴더로),
mv hello.txt hi.txt (hello.txt를 hi.txt로 이름변경을 해준다.)
cp : copy의 약자로 폴더나 파일을 복사할 때 사용한다.
ex)cp helloWorld.txt hiComputer.txt (원본파일 이름 복사할 파일 이름)
node.js의 버전을 손쉽게 바꿀 수 있는 매니저
필요한 모듈을 다운로드 할 수 있는 모듈 스토어
node.js 생태계의 패키지 매니저다.
const { range } = require('range'); // range 모듈을 불러옵니다
function getListMultiplesOfTwo(upTo) {
return range(2, upTo+2, 2);
// 100을 입력 했을 때 100까지의 2의 배수를 출력한다.
}
module.exports = getListMultiplesOfTwo;
Array.isArray([1, 2, 3]); // true
Array.isArray({foo: 123}); // false
Array.isArray('foobar'); // false
Array.isArray(undefined); // false
let arr = [1,2,3];
arr.pop(); // 3
arr.push('number'); // 3
console.log(arr); //-> [1, 2, 'number']
arr.shift(); // 1
arr.unshift("hi"); // 3
console.log(arr); //-> [ 1, 2, 'hi' ]
arr.splice(4,0,4,5,6); // arr = [1,2,3,4,5,6]
arr.splice(3,3); // arr = [1,2,3]
arr.reverse(); // arr = [3, 2, 1]
let arr = [11, 1, 115, 32, 12];
arr.sort() // arr = [1, 11, 115, 12, 42]
let arr = ['h','e','l','l','o'];
console.log(arr.join()); // 'h,e,l,l,o'
console.log(arr.join('')); // 'hello'
console.log(arr.join('+ ')); // 'h+ e+ l+ l+ o"
let arr = ['apple', 'banana', 'peach'];
console.log(arr.indexOf('apple')); // 0
console.log(arr.indexOf('peach')); // 2
console.log(arr.indexOf('dog')); // -1
let num = [1, 2, 3];
console.log(num.includes(2)); // true
console.log(num.includes(4)); // false
console.log(num.includes(3,3)); // false
conosle.log(num.includes(3,-1)); // true
let num = [1, 2, 3, 4, 5];
console.log(num.slice(0)); // [1, 2, 3, 4, 5]
console.log(num.slice(2)); // [3, 4, 5]
console.log(num.slice(2, 4)); // [3, 4]
console.log(num.slice(-3,5)); // [3, 4, 5]
let num = ['one', 2, 'three', 4, 5, 'six'];
conosle.log(num.toString()); // 'one,2,three,4,5,six'