title: Unable to add async / await and then unable to export variable. Any help appreciated
body: <p><strong><em>Background</em></strong>: Been trying for the last 2 day to resolve this myself by looking at various examples from both this website and others and I'm still not getting it. Whenever I try adding callbacks or async/await I'm getting no where. <strong>I know this is where my problem is but I can't resolve it myself.</strong></p>
  
  <p>I'm not from a programming background :( Im sure its a quick fix for the average programmer, I am well below that level.</p>
  
  <p><strong>When I console.log(final) within the 'ready' block it works as it should, when I escape that block the output is 'undefined' if console.log(final) -or- Get req/server info, if I use console.log(ready)</strong> </p>
  
  <pre><code>const request = require('request');
  
  const ready =
  // I know 'request' is deprecated, but given my struggle with async/await (+ callbacks) in general, when I tried switching to axios I found it more confusing.
  
  request({url: 'https://www.website.com', json: true}, function(err, res, returnedData) {
      if (err) {
      throw err;
    }
  
  var filter = returnedData.result.map(entry =&gt; entry.instrument_name);
  var str = filter.toString();
  var addToStr = str.split(",").map(function(a) { return `"trades.` + a + `.raw", `; }).join("");
  var neater = addToStr.substr(0, addToStr.length-2);
  var final = "[" + neater + "]";
  
  
  //  * * * Below works here but not outside this block* * *
  // console.log(final);
  
  
  });
  
  // console.log(final);
  // returns 'final is not defined'
  
  console.log(ready);
  // returns server info of GET req endpoint. This is as it is returning before actually returning the data. Not done as async.
  
  module.exports = ready;
  </code></pre>
  
  <p>Below is an short example of the JSON that is returned by website.com. The actual call has 200+ 'result' objects. </p>
  
  <p><strong>What Im ultimately trying to achieve is</strong> </p>
  
  <p>1) return all values of "instrument_name"</p>
  
  <p>2) perform some manipulations (adding 'trades.' to the beginning of each value and '.raw' to the end of each value. </p>
  
  <p>3) place these manipulations into an array.
        ["trades.BTC-26JUN20-8000-C.raw","trades.BTC-25SEP20-8000-C.raw"]</p>
  
  <p>4) export/send this array to another file.</p>
  
  <p>5) The array will be used as part of another request used in a websocket connection. The array cannot be hardcoded into this new request as the values of the array change daily. </p>
  
  <pre><code>{
    "jsonrpc": "2.0",
    "result": [
      {
        "kind": "option",
        "is_active": true,
        "instrument_name": "26JUN20-8000-C",
        "expiration_timestamp": 1593158400000,
        "creation_timestamp": 1575305837000,
        "contract_size": 1,
      },
      {
        "kind": "option",
        "is_active": true,
        "instrument_name": "25SEP20-8000-C",
        "expiration_timestamp": 1601020800000,
        "creation_timestamp": 1569484801000,
        "contract_size": 1,
      }
    ],
    "usIn": 1591185090022084,
    "usOut": 1591185090025382,
    "usDiff": 3298,
    "testnet": true
  }
  
  </code></pre>