iggs-utils - v2.4.0
    Preparing search index...

    Function takeRight

    • like lodash's takeRight, but also with offset.


      simply does

      array?.slice(array.length - n - offset , array.length - offset);
      

      Type Parameters

      • T

      Parameters

      • array: T[]

        The array to query.

      • n: number = 1

        The number of elements to take.

      • offset: number = 0

        The offset to apply for elements to take.

      Returns T[]

      Returns the slice of array.

      	takeRight([0, 1, 2, 3])			//=> [3]
      takeRight([0, 1, 2, 3], 2) //=> [2, 3]
      takeRight([0, 1, 2, 3], 2, 1) //=> [1, 2]