Share on Google+Share on Google+

Java Coder
javascript equality operator
1 Answer(s)      5 years ago
Posted in : JavaScript Questions

javascript equality operator - What are the different ways to check the equality between strings?

Ads

View Answers

March 23, 2012 at 1:37 PM


javascript equality operator

Equal (==) 

Not equal (!=)

Strict equal (===)
Strict not equal (!==)

Greater than (>)

Greater than or equal (>=)

Less than (<)

Less than or equal to (<=)

You can also check the equality like ..

'' == '0'           // false
0 == ''             // true
0 == '0'            // true

false == 'false'    // false
false == '0'        // true

false == undefined  // false
false == null       // false
null == undefined   // true

' \t\r\n ' == 0     // true

"variable=== undefined". If you want to check if a variable contains data use 

"if (variable)"

This is the same as 
"if (variable !== undefined && variable !== null)"
You should always use === instead of ==

With == you are implicitly doing a type conversion, e.g. 1 == "1" = true, 1 === "1" = false. 









Related Tutorials/Questions & Answers:
javascript equality operator
javascript equality operator  javascript equality operator - What are the different ways to check the equality between strings?   javascript equality operator Equal (==) Not equal (!=) Strict equal
JavaScript type of Operator
JavaScript type of Operator       The JavaScript type of operator returns the datatype... to show the use of type of Operator. The operator returns 'object' for the variable1
Advertisements
JavaScript basic
JavaScript basic  What is === operator ?   The ==== operator is strict equality operator, it returns true only when the two operands are having the same value without any type conversion
Equality and Relational Operators
 a is less than or equal to b The Equality operator "= =" differs from an assignment operator "=" i.e. the equality...Equality and Relational Operators   
PHP Logical Operator
then we need to use or (||) operator. There are many more operators
What is the % operator?
What is the % operator?   Hi, What is the % operator? thanks
AND operator in hibernate.
AND operator in hibernate.  How to use AND operator in hibernate
OR operator in hibernate.
OR operator in hibernate.  How to use OR operator in hibernate
Java operator
Java operator  Which Java operator is right associative
Java operator
Java operator  What is the difference between the prefix and postfix forms of the ++ operator
Java operator
Java operator  What are the legal operands of the instanceof operator
like operator
like operator  how to select exact value using like operator in php
ternary operator
ternary operator  (Ternary operator) Dearness Allowance= 25% of Basic pay house rent allowance= 15% of basic pay Provident fund= 8.33% of Basic pay Net pay=basic pay+Dearness allowance+house rent allowance Gross pay= Net pay
LIKE Operator
LIKE Operator       The LIKE operator is used for searching  a specified pattern in the column. In this example we will show you how to use the Like operator to get
What is the difference between the Boolean & operator and the && operator?
What is the difference between the Boolean & operator and the && operator?   Hello, What is the difference between the Boolean & operator and the && operator? thanks
SQL IN Operator
SQL IN Operator       SQL IN Operator helps you to specify multiple values in a WHERE Clause... IN Operator. In this example, we create a table 'Stu_Table'. The create
cannot do the additional operator
and multiplication operator...please anyone help me <html> <head> <title>Simple Calculator</title> <script language = "JavaScript... text field var operator = formCalculator.operator.value; //get input from first
c++ operator overloading
c++ operator overloading  What is operator overloading? and what is mean by overloading?? Can anyone please explain the concept in regards to C
Java 'or' operator
Java 'or' operator       OR operator is a kind of a conditional operators, which... between the two boolean expressions. The OR operator (|) is similar
JavaScript
JavaScript  clone JavaScript
why we use ^ operator in sql, and what is the meaning of that operator?
why we use ^ operator in sql, and what is the meaning of that operator?  why we use ^ operator in sql, and what is the meaning of that operator
PHP Concatenation Operator
PHP Concatenation Operator  Hi friends, Can any one guide me how to use the concatenation string operator in PHP
Operator Precedence
Operator Precedence       Operator Precedence : In Java, Operator Precedence is an evaluation.... When two operators share an operand then operator with the higher precedence
Java Questionmark operator
;  The only ternary (i.e. takes three values) operator in Java is the conditional operator.  Syntax: boolean-expression... This operator returns one of two values depending on a third value
javascript
javascript  javascript code to dynamically add table on button click.../javascript/javascriptexamples/javascript-add-row-dynamically.shtml http://www.roseindia.net/javascript/javascript-add-row-to-table.shtml http://www.roseindia.net
Javascript
Javascript  How validations are done using javascript ,with example? and interview questions on javASCRIPT
SQL BETWEEN Operator
SQL BETWEEN Operator       The SQL Between Operator works where you want to select a range of data between two values. In SQL, the BETWEEN operator is used to select a range
javaScript
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript
javascript
javascript  write a program to display implement about browsers using javascript
javascript
javascript  Hi deepak, how to write form validation on javascript
JavaScript
JavaScript  how to get full path of a file type in javascript
Tutorials   
Java Spring Hibernate Struts Training code for programming How can I dynamically load user-entered data as content of jquery dialog? java webcam integration question java coding Fix Scrollbar position in a checkboxList after postback Information Save Alert Country wise redirection to files Interface in javascript connect database with javascript Zip Code ZipCode how to validate the email login How to play FLV video files on Ipad using HTML code or javascript code? Nitobi Grid is not working in IE10/IE11 jquery issue plese help RegEx Tree structure from json whose parents can be dragged and dropped from child newyorklife insurance getElementById not working javascript code for search in html file Implement The Skeleton Code Implement This Skeleton Code Mobile Automation using Appium Computer forensic application Java: Searching a string from doc files java linked list urgent !!! java linked list urgent!!! library management library management library management library management question Html form using JavaScript to display the table content java how to prevent no from unroundin off on clicking text box again in JSP and Jquery graph generation from xml design file display data from database in textbox when id entered in textbox Javascript Code for all fields how to get HTTP GET request value using javascript array Javascript Querry autocomplete(): Spring mvc with jquery: I am not getting correct value in the text filed. Please help me Create SpreadSheet same as excel using java applet Create SpreadSheet same as excel using java applet How to change focus among multiple select boxes? Write JQUERY Code Write JQUERY Code Converting jsp variable to java variable java

Ads

 
Advertisement null

Ads