tearnarry's recent timeline updates
tearnarry

tearnarry

V2EX member #534329, joined on 2021-02-23 10:34:38 +08:00
Per tearnarry's settings, the topics list is hidden
Deals info, including closed deals, is not hidden
tearnarry's recent replies
既然 AI 可以解释清楚
1. 不会 Vibe Coding 出来屎山
2. 如果有 Vibe Coding 出来的屎山,继续让 AI 修复即可
原来是刷脸了,我说这么厉害没有任何确认一个链接就能直接扣钱
@SiLenceControL 差不得了,都要 2024 年了,高刷都没有的手机也谈体验
Dec 8, 2022
Replied to a topic by SeleiXi Node.js 新人求教如何在终端获得输入?
在 Node.js 中,可以使用 readline 模块来实现交互式的输入。该模块提供了一个接口,可以从命令行读取用户输入的一行文本。例如,以下代码演示了如何使用 readline 模块来获取用户在终端中输入的文本:

Copy code
const readline = require('readline');

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

rl.question('请输入文本: ', (answer) => {
// 在这里处理用户输入的文本
console.log(`您输入的文本是: ${answer}`);

rl.close();
});
上面的代码创建了一个 readline 接口,然后使用 question 方法向用户询问一个问题,并在用户输入文本后处理该文本。

需要注意的是,readline 模块只能在 Node.js 环境下使用,如果要在浏览器中实现交互式输入,则需要使用其他方式。
@djoiwhud 老哥在哪里?名字是啥
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5982 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 03:25 · PVG 11:25 · LAX 20:25 · JFK 23:25
♥ Do have faith in what you're doing.