Checks if the axis is valid.
Checks if the index is in bounds.
Returns the product of all elements in the array.