mercredi 28 juin 2017

Javascript IF loop not working properly

Just recently trying to get my head around javascript as I'm doing some front-end web development however I have just discovered something acting not quite as it should.

In the past, IF statements have worked exactly as they should, running the code if and only if the statement is true. However when I run this statement:

if ('2' !== 'None' && '2' !== '0') {
    alert('THIS IS A TEST')
}

Nothing happens. There are no syntax errors and I know the statement contained within the if loop evaluates to true as when I run it through the google console it tells me so.

Am I making a stupid mistake or I am I missing the intricacies of javascript logical operators.

Thanks to all who help me!

Aucun commentaire:

Enregistrer un commentaire