@extremejs/utils - v1.0.0-beta.23
    Preparing search index...

    Function slice

    • It will create a slice of the value (array/string) from start, up to, but not including, end.

      Type Parameters

      • Value extends string | unknown[]

      Parameters

      • value: Value
      • start: number = 0
      • end: number = value.length

      Returns Value

      1.0.0

      slice([0, 1, 2, 3, 4, 5], 2); // => [2, 3, 4, 5]
      
      slice([0, 1, 2, 3, 4, 5], 2, 5); // => [2, 3, 4]
      
      slice("012345"); // => "012345"
      
      slice("012345", 2, 4); // => "23"