Return the First Element in an Array

Published by Nomove in

Create a function that takes an array containing only values of the same type and return the first element.

Examples

GetFirstValue([5, 6, 7]) ➞ 5

GetFirstValue(["Semiramis", "Gaia", "Hypatia"]) ➞ "Semiramis"

GetFirstValue([true, false, true]) ➞ true

Notes

The first element in an array always has an index of 0.

Watch a quick demo on how Edabit works.