Function power

Raise each element in an array to the power of p.

> power([1, 2, 3], 2)
[1, 4, 9]
  • Parameters

    • array: number[]

      The array of numbers.

    • p: number

      The power to raise each element.

    Returns number[]

    An array with each input element raised to the power of p.