Retorne o último elemento

Dado um array ou uma string, retorne o último elemento do array ou o último caractere da string. Se o array ou a string estiverem vazios, retorne null.

Exemplos

last_item([0, 4, 19, 34, 50, -9, 2]); // ⟞ 2
last_item("The quick brown fox jumped over the lazy dog"); // ⟞ "g"
last_item([]); // ⟞ null