title: JavaScript arrow functions how do they work?
body: <p>So I'm new to using javascript, and I'm confused about how some things work. I've used python quite a bit and I understand it pretty well. I have never come across anything like arrow functions. This has probably been asked tons of times but how do arrow functions work? For eaxmple, using the requests module:</p>
  
  <pre class="lang-js prettyprint-override"><code>const request = require('request');
  request('http://www.google.com', (error, response, body) =&gt; {
    //do stuff with error, response, and body
  });
  console.log(body);
  </code></pre>
  
  <p>Could someone please tell how I can get the body variable out of the arrow function and get it in the rest of the code? Or in other words, declare it globally for the rest of the code to use.</p>