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]
CC-BY-SA 3.0 · Powered by MediaWiki
개인정보처리방침 · ABOUT