Make sure not to confuse !== with !=. The != operator is used to check if two values are not equal but it uses loose inequality.
The difference between loose and strict inequality is that for loose inequality, if the two values have different types, JavaScript will attempt to convert the values to the same type before comparing them.
With strict inequality, the two values must be of the same type or else they are automatically considered not equal.
Conclusion
In this post, we learned how to check if two strings are not equal to one another using the strict inequality operator.
While you can also use loose inequality, it is not recommended because it is not as predictable as strict inequality.
Hopefully, you learned something from this post. Thanks for reading!
To learn more about web development, founding a start-up, and bootstrapping a SaaS, follow me on X!