From a6d50f9a2a5dc022fb013bae003e7dbbe9413b1c Mon Sep 17 00:00:00 2001 From: Hyder Date: Mon, 25 Aug 2025 19:43:05 +0300 Subject: Im trying to learn JS, so THIS --- NGG/inputfunc.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 NGG/inputfunc.js (limited to 'NGG/inputfunc.js') diff --git a/NGG/inputfunc.js b/NGG/inputfunc.js new file mode 100644 index 0000000..c917ec5 --- /dev/null +++ b/NGG/inputfunc.js @@ -0,0 +1,17 @@ +const readline = require('readline'); + +function input(prompt) { + const read_instance = readline.createInterface({ + input: process.stdin, + output: process.stdout + }); + + return new Promise((resolve) => { + read_instance.question(prompt, (val) => { + read_instance.close(); + resolve(val.trim()); + }); + }); +} + +module.exports = { input }; \ No newline at end of file -- cgit v1.2.3