gpt4 book ai didi

javascript - 我想记忆一下 readline 。怎么做?

转载 作者:行者123 更新时间:2023-11-30 21:09:15 24 4
gpt4 key购买 nike

我想记忆一下

rl.question("input your port do you want (about 0 - 65535) : ", function(portnumber)

在此之后:

if(netinfo > 6665){
return console.log("Error stupid i say about 0 - 65535")
}

rl.question("input your port do you want (about 0 - 65535) : ", function(portnumber){
if(netinfo > 6665){
return console.log("Error stupid i say about 0 - 65535")
}

netinfo = portnumber;

const requestHandler = (request, response) => {
console.log(request.url)
response.write('<b>welcome to groone simple http server :p </b>');
response.end('ahahahahahah :)');
}

怎么做?

最佳答案

我看到的唯一方法是递归:

(function restart(){
rl.question("input your port do you want (about 0 - 65535) : ", function(portnumber){
if(portnumber > 6665){
console.log("Error stupid i say about 0 - 65535");
return restart();
}
//...
});
})()

关于javascript - 我想记忆一下 readline 。怎么做?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46301796/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com