函数返回函数未定义

时间:2019-08-30 14:57:54

标签: javascript node.js

显示undefined
如何让函数天气返回str值?(对不起我的英语不好)

function weather(urlin){
    request.get(urlin,function(err,res,body){
        after = JSON.parse(body);
        weatherary = [];
        weatherary[0] = String(after.records.locations[0].location[0].weatherElement[0].time[0].elementValue[0].value);
        replyary = weatherary[0].split("。");
        t = String(replyary[2].match(/\d+/g));
        tempa = t.replace(',','~');
        str = replyary[0] + '\n?' + replyary[1].match(/\d+/g) + '% ' + '?' + tempa;
    });
    return str;
};

0 个答案:

没有答案