const CODES = { A: 65, Z: 90, }; function createCell(cellContent = '') { return `
${cellContent}
`; } function createCol(columnContent = '') { return `
${columnContent}
`; } function createRow(dataContent = '', infoContent = '') { return `
${infoContent}
${dataContent}
`; } export function createTable(rowsCount = 10, columnCount = 10) { const colsCount = Math.min(CODES.Z - CODES.A + 1, columnCount); const rows: string[] = []; const cols = new Array(colsCount) .fill('') .map((el, index) => String.fromCharCode(CODES.A + index)) .map((el) => createCol(el)) .join(''); rows.push(createRow(cols)); for (let i = 0; i < rowsCount; i++) { const cells = new Array(colsCount).fill(createCell()).join(''); rows.push(createRow(cells, `${i + 1}`)); } return rows.join(''); }