const https = require('https');
const request = require('request');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', function(inputStdin) {
    inputString += inputStdin;
});
process.stdin.on('end', function() {
    inputString = inputString.split('\n');
    main();
});
function readLine() {
    return inputString[currentLine++];
}
async function getCountryName(code) {
    for (var i = 1; i<26; i++)
    {
    const url= 'https://jsonmock.hackerrank.com/api/countries?page='+i
     await request({url,json:true}, (error,{body})=>{
         for(var i=0; i<10 ; i++)
         {
             if (body.data[i].alpha2Code == code)
             {
                console.log(body.data[i].name)
                return body.data[i].name
                break
             }
         }
     })}
    //  return name
}
async function main() {
  const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
  const code = readLine().trim();
  const name = await getCountryName(code);
  ws.write(`${name}\n`);
}
when i run this program, it showing undefined as a result instead of place name. But when I log it showing correct value.
Below is the intelligence when I keep my cursor on getCounrtyName function.
function getCountryName(code: any): Promise<void>
I think it should be sent as a response to the promise and I don't know that.
