如何可以让这段代码无限循环
const request = require("request");
let url = 'http://xxxxxxx';
function post(n){
request({
url: url,
method: "POST",
headers: {
"content-type": "application/json",
}
}, function(error, response, body) {
if(body !== undefined){
let buff = Buffer.from(body)
//console.log(buff)
buff = buff.slice(3,buff.length)
let data = JSON.parse(buff)
if(data.code == '1'){
console.log(n);
}else{
settimeout(post, 2000);
}
}
});
}
for(let n = 1; n < 100000; n++){
setTimeout(post, 300*n, n);
}
let n = 0
while(true){
}