[wecode/pre/Replit] 07. Array - 03. 배열 요소 접근

2022. 10. 4. 11:03pre-JS-Replit

 Read.me 
# 03. 배열 요소 접근

우리는 인덱스(index)를 사용해 배열 안의 데이터에 접근할 수 있습니다.

```js
let array = [50,60,70];
array[0]; // equals 50
array[1]; // equals 60

```

# Assignment

- 변수 firstValue를 선언해주세요.
- firstValue의 값은 배열 myArray의 첫 번째 값입니다.

 index.js 
function arrayIndex() {
  // do not change your code here
  const myArray = [50, 60, 70];
  
  // write your code below
  let firstValue = myArray[0];

  // do not change your code here
  return firstValue;  
}

console.log(arrayIndex())

module.exports = { arrayIndex }
▶ 배열의 순서
  ▷ let myArray = ['가',  '나',  '다',  '라'];
      myArray[0] = '가'
      myArray[1] = '나'
      myArray[2] = '다'
      myArray[3] = '라'
      배열의 순서는 0부터 !!

 console 
50