Repeat and Character Access
JS · Stringssyntax
str.repeat(count)
str.at(index)example
const border = "=".repeat(30);
console.log(border);
const word = "JavaScript";
console.log(word.at(0)); // "J"
console.log(word.at(-1)); // "t"Note at() supports negative indices to count from the end. Bracket notation str[-1] returns undefined, not the last character.