mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2025-05-18 12:02:53 +02:00
feat: rewrite programming-challenges CLI (#3)
This commit is contained in:
15
templates/solution/typescript/solution.ts
Normal file
15
templates/solution/typescript/solution.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import readline from 'readline'
|
||||
|
||||
const input: string[] = []
|
||||
const readlineInterface = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
})
|
||||
readlineInterface.on('line', (value) => {
|
||||
input.push(value)
|
||||
})
|
||||
readlineInterface.on('close', solution)
|
||||
|
||||
function solution(): void {
|
||||
console.log(`Hello, ${input[0]}!`)
|
||||
}
|
Reference in New Issue
Block a user