배열 (Array) 1) 배열 초기화 const arr1 = new Array(); // new 사용 const arr2 = [1, 2]; // 대괄호 사용 2) 인덱스를 이용한 접근 const animals = ['🐶', '🐱', '🐷']; console.log(animals); console.log(animals.length); console.log(animals[0], animals[2]); console.log(animals[3]); // undefined console.log(animals[animals.length - 1]); // last 3) 반복문을 이용한 요소 제어 const animals = ['🐶', '🐱', '🐷']; // 고전적인(전통적인) 방법 // for (let i = 0 ..
[React] 리액트 Array 배열 개념 및 활용 + 연습문제
배열 (Array) 1) 배열 초기화 const arr1 = new Array(); // new 사용 const arr2 = [1, 2]; // 대괄호 사용 2) 인덱스를 이용한 접근 const animals = ['🐶', '🐱', '🐷']; console.log(animals); console.log(animals.length); console.log(animals[0], animals[2]); console.log(animals[3]); // undefined console.log(animals[animals.length - 1]); // last 3) 반복문을 이용한 요소 제어 const animals = ['🐶', '🐱', '🐷']; // 고전적인(전통적인) 방법 // for (let i = 0 ..
🗓️ 2023.09.04
🗨️0