freeCodeCamp/guide/english/certifications/javascript-algorithms-and-d.../basic-javascript/comparison-with-the-inequal.../index.md

17 lines
474 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Comparison with the Inequality Operator
---
## Comparison with the Inequality Operator
* `!=` (Inequality) is a logical operator that returns true case the value on the left is different from the one on the right.
* The inequality operator considers `7` and `"7"` to be the same because it doesn't compare the type of the variable.
## Basic Solution
```javascript
function testNotEqual(val) {
if (val != 99)
return "Not Equal";
return "Equal";
}
```