Skip to content

Instantly share code, notes, and snippets.

@LeWawan
Created September 25, 2018 10:18
Show Gist options
  • Save LeWawan/e5f5661704689fafd6871c292111715d to your computer and use it in GitHub Desktop.
Save LeWawan/e5f5661704689fafd6871c292111715d to your computer and use it in GitHub Desktop.
function showMenu (menu) {
const args = process.argv
const items = menu
.map((item, i) => `${i}. ${item}`)
.join('\n')
console.log(`
===============================
what you choice ?
===============================
${items}
===============================
you choice ${menu[args[2] - 1]}
===============================
`)
}
module.exports = {
showMenu: showMenu
}
const app = require('./app.js')
const fs = require('fs')
const menu = fs.readFile('./items.txt', 'utf8', (error, item) => {
console.log(item)
})
// app.showMenu(menu)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment