Get nth character of string

Write a function that takes a string (a) and a number (n) as argument. Return the nth character of 'a'.
function
myFunction
(
a, n
)
{

return
}
Test Cases:
myFunction('abcd',1)
Expected
'a'
myFunction('zyxbwpl',5)
Expected
'w'
myFunction('gfedcba',3)
Expected
'e'

How to solve it

In order to get the nth character of a given string, you have to know its index. An index describes the position of a character in a given string. Javascript strings are zero-indexed. This means that the first character of a string has index 0. The second character has index 1 and so on.
const string = 'abcdefg'; // get first character console.log(string[0]) // output: 'a' // get third character console.log(string[2]) // output: 'c'