Interface da linha de comando JS do nó
process.stdin.on('data', (data) => {
data = data.toString().trim();
if (data === "Hi") {
console.log("Hello");
}
});
Vitus
process.stdin.on('data', (data) => {
data = data.toString().trim();
if (data === "Hi") {
console.log("Hello");
}
});
//Found it on this profile: https://www.codegrepper.com/profile/different-dunlin-dizu3imsdd6p
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
readline.question('Who are you?', name => {
console.log(`Hey there ${name}!`);
readline.close();
});