Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,854 questions

51,775 answers

573 users

How to use not equal comparison operators (!=, !==) in JavaScript

1 Answer

0 votes
var x = 13;
var y = 5
if (x != y)  // true
    document.write("1. x != y" + "<br />"); 

if (x !== y) // true
    document.write("2. x !== y" + "<br />"); 

x = 13;
y = "5";
if (x != y) // true 
    document.write("3. x != y" + "<br />"); 

if (x !== y) // true
    document.write("4. x !== y" + "<br />"); 
    
x = 13;
y = "13";
if (x != y) // false 
    document.write("5. x != y" + "<br />"); 

if (x !== y) // true // not equal type
    document.write("6. x !== y" + "<br />"); 


  
/*
run:

1. x != y
2. x !== y
3. x != y
4. x !== y
6. x !== y

*/

 



answered Apr 17, 2017 by avibootz
...