In the above code snippet we used the simple way of writing program on Not equal to operator in JavaScript. NOTE: The Not equal to operator value can be written as a != 30 or a != "30", both gives the same result.īasic way of using Not equal to operator Other way to write Not equal to operator in JavaScript.ĭocument.getElementById(" myId").innerHTML = c In the above code snippet we have given same values to the variable a and to the not equal operator, so the result give 'false'. In the above code snippet we have given two different values to the variable a and to the not equal operator, so the result gives 'true'.Īssigning same values Assigning 'a' value as 30 and checking the value with '30' in not equal to operator, so the result givesĭocument.getElementById(" myId").innerHTML = ( a != 30) Assigning different values Assigning 'a' value as 30 and checking the value with '10' in not equal to operator, so the result givesĭocument.getElementById(" myId").innerHTML = ( a != 10) The symbolic representation of Not equal operator in JavaScript is !=. ![]() For example, if we want to find all the lines not containing the word foo, do: /((.foo.).) Here is an example: When examining a log file, you might only be interested in lines not containing the word 'Warning', so the search command is: /(.Warning). ![]() If the value of two operands are not equal it returns true. This will find everything but the regular expression you have specified. Not equal is an comparison operator which is used to check the value of two operands are equal or not. In the previous post we learnt the Equal opeartor, from this post we are going to learn the Not equal operator in Comparison Operators.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |