-
[메소드] Array(n).fill(x)프론트엔드/Javascript 2023. 7. 6. 18:25
const a = Array(5).fill(2) // length 5의 배열을 생성하고, 각 요소를 2로 채운다. // [2,2,2,2,2]
728x90반응형'프론트엔드 > Javascript' 카테고리의 다른 글
[JS] 배열 분할 할당(Destructuring Assignment) (0) 2023.07.27 [메소드]Number.prototype.toFixed() (0) 2023.07.26 [Javascript] 문자열 '... ' 생략 처리하기 (0) 2022.02.04