Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 520 Bytes

splice-arrays.md

File metadata and controls

22 lines (17 loc) · 520 Bytes
title tags goal date
Splice using Array.splice
Javascript
Front-End Engineering
2019-06-01
  • changes array contents in place by removing or replacing existing elements and/or adding new elements

  • remove a range of elements:

gas.splice(0,4) // removes first four elements
  • splice in new elements at the beginning, middle, or end, replacing the Index → Count range defined by the first two args:
gas.splice(1, 0, 'foo', 'bar'); // inserts two new els at idx 1