안녕하세요 2년차 개발자입니다.
카페에서 커피마시면서
코딩하기를 좋아해요.

Software Engineer

Array in JS

Array 다루기

  const array = [1, 2, 3];

  console.log(array.length); // 3

  array.length = 0;

  console.log(array.length); // 0

  const array2 = [2, 3, 4];
  
  console.log(array2.length); // 3

  array2.length = 10;

  console.log(array2); // [2, 3, 4, , , , , , , ,];

배열 요소 접근하기

  const array = [1,2,3];

  function operateTime([firstInput, secondInput],) {
    
  }

배열 메서드 체이닝 활용하기


const suffixWon = (price) => price + '';
  
const getWonPrice(priceList) {
  return priceList.filter(isOverThousand).sort(ascendingList).map(suffixWon);
}

const result = getWonPrice(price);

console.log(result); // [2000원, 3000원, 4000원, 5000원];