const s = "abc"; // at() accepts negative indices and may be undefined const last: string | undefined = s.at(-1); console.log(s.at(0), last);
at() returns string | undefined