var strExt = GetAttributeFromItemTable(itemTable, "Ext", "FileType");
I did a alert for strExt and it resolves. if (strExt!='wav') { // this works }
if (strExt!='wav' || strExt!='mp3')
{
// this does not work.
}
The OR || operator does the following: Evaluates operands from left to right. For each operand, converts it to boolean. If the result is true , stops and returns the original value of that operand.
The logical OR operator ( || ) returns the boolean value true if either or both operands is true and returns false otherwise.
Open your page in a browser, then open the developer tools. In Chrome on Windows, it's ctrl+shift+i . If you are including an external JavaScript file, check for 404 errors in case the path to your file is incorrect. Check for any JavaScript errors that appear in the console.
Your logic is flawed:
if your variable strExt
was equal to 'wav'
it would not be equal to 'mp3'
, and versa-visa.
Please explain your desired results more clearly.
I think what you're trying to say is something like (neither 'wav'
nor 'mp3'
):
if ( !( strExt == 'wav' || strExt == 'mp3' ) )
which is logically equivalent to (not 'wav'
and not 'mp3'
):
if ( strExt != 'wav' && strExt != 'mp3' ) )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With