当我调用此功能时:
function getweb(addr){
request(addr, function (err, response, body) {
let artlatestjson = JSON.parse(body);
aart = artlatestjson.title;
alink = artlatestjson.url;
ascore = "| Score " + artlatestjson.score;
return(aart)
});
}
使用:
console.log(getweb(jsonfileaddres))
(jsonfileaddres是json文件的url)
它总是返回undefined,即使aart设置为corect的东西。