javascript equality operator



Share on Google+Share on Google+

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

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

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
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
PHP Logical Operator
then we need to use or (||) operator. There are many more operators
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   
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
What is the % operator?
What is the % operator?   Hi, What is the % operator? thanks
Java operator
Java operator  Which Java operator is right associative
Java operator
Java operator  What are the legal operands of the instanceof operator
Java operator
Java operator  What is the difference between the prefix and postfix forms of the ++ 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
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
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
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
JavaScript  clone JavaScript
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
javascript  javascript code to dynamically add table on button click.../javascript/javascriptexamples/javascript-add-row-dynamically.shtml
Javascript  How validations are done using javascript ,with example? and interview questions on javASCRIPT
should use JavaScript? Thanks   Hi, JavaScript is scripting language that runs on browser. You have to embed JavaScript in HTML page. Please see JavaScript tutorial. Thanks
JavaScript  how to get full path of a file type in javascript
javascript  Hi deepak, how to write form validation on javascript
javascript  write a program to display implement about browsers using javascript
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript
javascript  i have just learned javascript... can you tell me what kind of applications can be made by javascript?? thank you
javascript  how to set the request or session attribute in javascript head part of jsp page
javascript  Hi sir, This is sinduri, i want to learn javascript, so plz can u help to learn
javascript  hi sir, if i want to learn javascript. what concepts i want to know
JAVASCRIPT  I have one textbox and I want to validate that it must start with number(1-0). can anyone tell me a javascript for that ? thanks in advance
Javascript   Javascript to check Numeric entry in checkbox.....   Hi Please find the following code for numeric entry validation in javascript function validateBox(){ var data=document.myForm.someText.value