JavaScript fill()

Jmnote (토론 | 기여)님의 2023년 10월 7일 (토) 19:54 판 (새 문서: ==개요== ;JavaScript fill() <syntaxhighlight lang='javascript' run> const array1 = [1, 2, 3, 4]; console.log(array1.fill(0, 2, 4)); // [1, 2, 0, 0] console.log(array1.fill(5, 1));...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

JavaScript fill()
JavaScript
Copy
const array1 = [1, 2, 3, 4];
console.log(array1.fill(0, 2, 4)); // [1, 2, 0, 0]
console.log(array1.fill(5, 1)); // [1, 5, 5, 5]
console.log(array1.fill(6)); // [6, 6, 6, 6]
[1, 2, 0, 0] 
[1, 5, 5, 5] 
[6, 6, 6, 6] 

2 같이 보기[ | ]

3 참고[ | ]