// package
last-char
type: "module"
// preferences
// replacements (1)
snippet::char-last
Simple or drop-in replacementThis package is no longer necessary. You can use `str.at(-1)` if supported or `str[str.length - 1]` to get the last character of a string.
// example
const last = (str) => str.at(-1);
// or in older environments
const lastLegacy = (str) => str[str.length - 1];