title: UnhandledPromiseRejectionWarning: Reject an unhandled promise when processing certain cases with the question
body: <p>I have this question that addresses a bunch of cases:</p>
  <pre><code>Your function must always return a promise
  If data is not a number, return a promise rejected instantly and give the data &quot;error&quot; (in a string)
  If data is an odd number, return a promise resolved 1 second later and give the data &quot;odd&quot; (in a string)
  If data is an even number, return a promise rejected 2 seconds later and give the data &quot;even&quot; (in a string)
  </code></pre>
  <p>I typed the code for the question, but I got this error:</p>
  <pre><code>(node:6) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ReferenceError: data is not defined
  (node:6) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  </code></pre>
  <p>This is the code:</p>
  <pre><code>const job = new Promise((resolve, reject)=&gt;{
      if(isNaN(data)){
          reject('erroe')
      }
      else if(isNaN(data) &amp;&amp; data%2!=0){
          setTimeout(function(){
              resolve('odd')
          } , 1000)
      }
      else {
          setTimeout(function(){
              reject('even')
          }, 2000)
      }
  })
  
  
  module.exports = job;
  </code></pre>