Skip to content

Commit 89a7021

Browse files
committed
Adds row numbs to output
Also fixes table synax with line
1 parent 5e056e4 commit 89a7021

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/2019/day/16.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
```
22
var table = function(input) {
33
let pad = String(input.length).length;
4-
let space = ' '.padStart(pad) + ' ';
5-
let header = space + `| ${input.join(' | ')} |`;
6-
let line = space + Array(header.length - space.length).fill('-').join('');
4+
let space = '#'.padStart(pad);
5+
let header = `| ${space} | ${input.join(' | ')} |`;
6+
let line = header.split('').map(c => c === '|' ? '|' : '-').join('');
77
let grid = [];
88
99
let mid = Math.floor(input.length / 2);
@@ -32,7 +32,7 @@ var table = function(input) {
3232
row.push(char);
3333
}
3434
35-
grid.push(`${(y+1).toString().padStart(pad)} | ${row.join(' | ')} |`);
35+
grid.push(`| ${(y+1).toString().padStart(pad)} | ${row.join(' | ')} |`);
3636
}
3737
3838
let output = [header, line, ...grid].join('\n');

0 commit comments

Comments
 (0)