Skip to content

Latest commit

 

History

History
11 lines (8 loc) · 264 Bytes

replace-array-contents.md

File metadata and controls

11 lines (8 loc) · 264 Bytes

replace array contents

Replace the contents of an array without creating a new one. This is sometimes needed when a client relies on array references and mutation.

const a = [ 1, 2, 3 ]
replaceArrayContents(a, [ 2, 3, 4 ])

a // [ 2, 3, 4 ]