title: Function constructor method
body: <p>How can i use this method from my own project/design</p>
  
  <pre><code>Github.prototype.handleErr = function(res) {
    if(!res.ok) {
     throw new Error('Something went wrong!!' + res.status);
    }
  
    return res;
   }
  </code></pre>
  
  <p>Inside another method but the same object</p>
  
  <pre><code>const git = new Github();
  
  Github.prototype.getUser = (user) =&gt; {
  return new Promise((resolve, reject) =&gt; {
      // Profile
      fetch(something)
      .then(this.handleErr)
      .then(response =&gt; response.json())
      .then(data =&gt; resolve(data))
      .catch(err =&gt; reject(err));
  })
  </code></pre>
  
  <p>}</p>
  
  <p>it didn't work with this.handleErr</p>
  
  <p>i wanted to make a fetch request and use the <code>git.handleErr()</code> function inside <code>.then()</code> consumer, before handling the data response.</p>