@jonahsnider/util

    Function padStart

    • Pads an array with a given value so that the array reaches a given length. The padding is applied from the start (left) of the array.

      Time complexity: O(n)

      Space complexity: O(n)

      Type Parameters

      • T

      Parameters

      • array: T[]

        The array to pad

      • maxLength: number

        The length of array once it has been padded. If this parameter is smaller than the current string's length, array will not be modified

      • fillValue: T

        The value to pad the array with

      Returns void

      const array = [1, 2, 3];

      padStart(array, 4, 0);

      console.log(array); // [0, 1, 2, 3]

      padEnd to pad the end of an array

      Array

    MMNEPVFCICPMFPCPTTAAATR