Check if two Strings are NOT equal in JavaScript-Code Examples

Radu TM

Check if two Strings are NOT equal in JavaScript

JavaScript by Radu TM June 21, 2022

let str1 = 'I ❤️ JS';
let str2 = 'I hate JS';

// Check if str1 is NOT equal to str2
if (str1 !== str2) {
  console.log('The strings are NOT equal.');
}

0

19.772

Check if two Strings are NOT equal in JavaScript

JavaScript by Radu TM June 21, 2022

const a = 'a'
const b = 'b'

if (a !== b) {
  console.log('🎉 The strings are not equal!')
} else {
  console.log('The strings are equal.')
}

0

19.772

Related JavaScript Queries

Latest JavaScript Queries

Explore code examples by categories