aboutsummaryrefslogtreecommitdiff
path: root/NGG/inputfunc.js
diff options
context:
space:
mode:
authorHyder <hyder@hyderhadi.xyz>2025-08-25 19:43:05 +0300
committerHyder <hyder@hyderhadi.xyz>2025-08-25 19:43:05 +0300
commita6d50f9a2a5dc022fb013bae003e7dbbe9413b1c (patch)
tree0b8c16d63e61bc788355034ba00e51a8086c63ee /NGG/inputfunc.js
parentb4c6db0fc67d2d3f85891b0eca767bd0fa063379 (diff)
Im trying to learn JS, so THIS
Diffstat (limited to 'NGG/inputfunc.js')
-rw-r--r--NGG/inputfunc.js17
1 files changed, 17 insertions, 0 deletions
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