TypeScript Add Border
function addBorder(picture: string[]): string[] {
const width = picture[0].length;
const bordered = picture.map((row) => `*${row}*`);
const border = "*".repeat(width + 2);
return [border, ...bordered, border];
}
This builds a new grid with a * border around every side. It adds a full top and bottom row, then wraps each existing row from left and right.