자바스크립트 배열 (JAVASCRIPT ARRAY)
const color = ['red', 'blue', 'orange', 'yellow', 'green'];
console.log(color[0]) // 배열의 0번째 인덱스를 콘솔에 띄워줌
// red
color.length; // 배열의 요소 개수 알려줌
// 5
color[5] = 'apple';
// color = ['red', 'blue', 'orange', yellow', 'green', 'apple']
color.shift(); // 배열의 맨 처음 값을 제거해줌
//color = [blue', 'orange', yellow', 'green', 'apple']
color.unshift('red'); // 배열의 맨 앞에 'red'를 넣어줌
//color = ['red', 'blue', 'orange', yellow', 'green', 'apple']
color.push('grape') //배열 맨 뒤에 grape가 추가됨
//color = ['red', 'blue', 'orange', yellow', 'green', 'apple', 'grape']
color.pop() //배열 맨 마지막이 제거됨
//color = ['red', 'blue', 'orange', yellow', 'green', 'apple']
color.splice(2, 1) // color배열의 2번째 인덱스부터 1개 지운다
// color = ['red', 'blue', 'yellow', 'green', 'apple']
color.splice(3, 3, 'black', 'pink') // color 배열의 3번째 배열부터 2개를 black, pink로 바꾼다.
// color = ['red', 'blue', 'yellow', 'black', 'pink']