배열

JavaScript

JS | Array

Array 1. Declaration const arr1 = new Array(); const arr2 = [1, 2]; 2. Index position const fruits = ['🍎', '🍌']; console.log(fruits); console.log(fruits.length); console.log(fruits[0]); console.log(fruits[fruits.length - 1]); // array의 index는 0부터 시작 3. Looping over an array mission. print all fruits a. for for (let i = 0; i < fruits.length; i++) { console.log(fruits[i]); } b. for of for (let fru..

3jun
'배열' 태그의 글 목록