resize Method

  • If newLength is less than current length, just reset current length to newLength, effectively trimming active entries but preserving original capacity.
  • If newLength is greater than current length, reallocate to (exactly) newLength, copy existing entries, and pad with padValue up to newLength.

resize(newLength: number, padValue: number = 0): void

Parameter Type Description
newLength number new data count
padValue number value to use for padding if the length increases.

Returns - void

Defined in

Last Updated: 30 November, 2023