You are helping translate human speech into computer terms.
You will be given a list of names
, and you will return one of those names.
You will also be given a position
. This number is the position of the name you need to return in human terms.
In other words, you will need to translate the human number into a computer index. So if the number is 1
, meaning the first item in the list, you need to return the array element at index 0
, since that is the first element in the array.
For example:
const names = ['Alex', 'Bri', 'Cory', 'Diana'];
const result = getNameAtPosition(names, 2);
console.log(result); // "Bri"