Get nth element of array

Write a function that takes an array (a) and a value (n) as argument. Return the nth element of 'a'
function
myFunction
(
a, n
)
{

return
}
Test Cases:
myFunction([1,2,3,4,5],3)
Expected
3
myFunction([10,9,8,7,6],5)
Expected
6
myFunction([7,2,1,6,3],1)
Expected
7

How to solve it

In order to get the nth element of a given array, you have to know its index. An index describes the position of an element in a given array. Javascript arrays are zero-indexed. This means that the first element of an array has index 0. The second element has index 1 and so on.
const arr = [1,2,3,4,5]; // get first element console.log(arr[0]) // output: 1 // get last element console.log(arr[4]) // output: 5