javascript초기화
![[JavaScript] 알고리즘에 쓰이는 문법 (배열초기화)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2Feb0fwB%2Fbtq1I8pCbyN%2FAAAAAAAAAAAAAAAAAAAAAFvv7tX5w5vSMfYBO-PIko6o94nchz36zckSXttob2Hi%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DTYV%252FWKKJROkLKQkD6IOB6Lqeeng%253D)
[JavaScript] 알고리즘에 쓰이는 문법 (배열초기화)
new Array 초기화 할 값의 길이를 정할 수 있음 prices = [1,2,3,4,5] answer = new Array(prices.length) >>[ ] Array.from 초기화할 범위와 값을 정할 수 있다 const arr = Array.from({length: 5}, (v, i) => i); // i(index) 1씩 증가 console.log(arr); // => Array(5) [0, 1, 2, 3, 4] console.log(arr[0]); // => 0 console.log(arr.length); // => 5 /* 콜백함수의 첫번째 매개변수, v 생략시 undefined 반환 */ const arr = Array.from({length: 5}, (i) => i); console...