Skip to content

Instantly share code, notes, and snippets.

@sky172839465
Last active June 6, 2019 13:25
Show Gist options
  • Save sky172839465/b3f761ac2a9e87a519f112955c1bd6ff to your computer and use it in GitHub Desktop.
Save sky172839465/b3f761ac2a9e87a519f112955c1bd6ff to your computer and use it in GitHub Desktop.
Generate nine nine table
const fs = require('fs')
let contents = ''
for (let i = 1; i <= 9; i++) {
let row = []
for (let j = 1; j <= 9; j++) {
row.push(`${i} x ${j} = ${i * j}`)
}
contents += `|${row.join('|')}|\n`
}
const table =
`||||||||||
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
${contents}
`
fs.writeFileSync('./nine-nine-table.md', table, 'utf8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment