const readline = require('readline');
const rl = readline.createInterface({input: process.stdin, output: process.stdout});
const answer = await rl.question('What is your favorite food? ');
console.log(`Oh, so your favorite food is ${answer}`);
这是我使用的代码和等待是不工作它说使用高级模块
1条答案
按热度按时间myzjeezk1#
除非代码在
async function
或模块中,否则不能使用await
。您可以做的是: