title: Nodejs doesnt recognize async function and reference
body: <p>When i run my project in terminal like this
  node index.js</p>
  <p>I get a reference error: config not defined</p>
  <p>/home/ether/Documents/nodesendeth/index.js:6
  const {asset, base, spread, allocation} = config;
  ^</p>
  <pre><code>ReferenceError: config is not defined
      at tick (/home/ether/Documents/nodesendeth/index.js:6:47)
      at run (/home/ether/Documents/nodesendeth/index.js:49:3)
      at Object.&lt;anonymous&gt; (/home/ether/Documents/nodesendeth/index.js:52:1)
      at Module._compile (internal/modules/cjs/loader.js:1151:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
      at Module.load (internal/modules/cjs/loader.js:1000:32)
      at Function.Module._load (internal/modules/cjs/loader.js:899:14)
      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
      at internal/main/run_main_module.js:17:47
  </code></pre>
  <p>in my code i have assigned the config constant like this:</p>
  <pre><code>require('dotenv').config;
  const ccxt = require('ccxt');
  const axios = require('axios');
  
  const tick = async =&gt; {
      const {asset, base, spread, allocation} = config;
      const market = `${asset}/${base}`;
  
      const orders =  binanceClient.fetchOpenOrders(market);
      orders.forEach(async order =&gt; {
          await binanceClient.cancelOrder(order.id);
      });
      const results =  Promise.all([
        axios.get('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&amp;vs_currencies=usd'),
        axios.get('https://api.coingecko.com/api/v3/simple/price?ids=tether&amp;vs_currencies=usd')
      ]);
      const marketPrice = results[0].data.bitcoin.usd / results[1].data.tether.usd;
  
      const sellPrice = marketPrice * (1 + spread);
      const buyPrice = marketPrice  * (1 - spread);
      const balances = binanceClient.fetchBalance();
      const assetBalance = balances.free[asset];
      const baseBalance = balances.free[base];
      const sellVolume = assetBalance * allocation;
      const buyVolume = (baseBalance * allocation) / marketPrice;
  
      binanceClient.createLimitSellOrder(market, sellVolume, sellPrice);
      binanceClient.createLimitBuyOrder(market, sellVolume, buyPrice);
  
       console.log(`
          New tick for ${market}...
          Created limit sell order for ${sellVolume}@${sellPrice}
          Create limit buy order for ${buyVolume}@${buyPrice}`)
  }
  
  const run = () =&gt; {
      const config = {
        asset: 'BTC',
        base: 'USDT',
        allocation: 0.1,
        spread: 0.2,
        tickInterval: 2000
      };
    const binanceClient = new ccxt.binance({
      apiKey: process.env.API_ENV,
      secret: process.env.API_SECRET,
    });
  
    tick(config, binanceClient);
    setInterval(tick, config.tickInterval, config, binanceClient);
  }
  run()
  </code></pre>
  <p>I also got await errors saying that i need to run them in an sync function which I do.
  i have removed the await keyword now but the app should run with the await kewyword because those functions are async.</p>
  <p>Why am i getting those errors when i have a config variable aswell as an async function?</p>
  <p>I assume that something with my async function doesnt work because it neither recognises the config constant nor the async/await calls</p>