title: Why is OR not working as expected inside the IF statement?
body: <p>I have a function to upload a file to S3 and want to only allow PNG and (JPG, JPEG) images to be uploaded.  I added the following check;</p>
  <pre><code> if(fileExtension.toUpperCase() != 'png'.toUpperCase() || fileExtension.toUpperCase() != 
   'jpeg'.toUpperCase() || fileExtension.toUpperCase() != 'jpg'.toUpperCase()) {
   return {
          statusCode: 500,
          body: JSON.stringify(&quot;Not a valid capture format.  Capture upload only accepts PNG and 
    (JPG,JPEG)&quot;),
       };
   }
   else {
    // Upload capture
  }
  </code></pre>
  <p>What happens is that it returns the error message below to say it is not a valid capture format even when I expect it to be.  For example, <code>filePrefix</code> is <code>jpg</code> therefore I expect it to go into the <code>else</code> statement.</p>
  <p><strong>EDIT</strong></p>
  <p>How can I only allow files with the PNG, JPG or JPEG extensions to be uploaded to S3? If it is anything other than those extensions, I want to return an error as shown above.</p>
  <p>Thanks all.</p>