Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaScriptQuestions javascript equality operator
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


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


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


Advertisement
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
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
JavaScript
JavaScript  clone JavaScript
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
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  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
What does the delete operator do?
What does the delete operator do?  What does the delete operator do
Explain the ternary conditional operator in PHP?
Explain the ternary conditional operator in PHP?  Explain the ternary conditional operator in PHP
What does the delete operator do?
What does the delete operator do?  What does the delete operator do
Javascript
Javascript  How validations are done using javascript ,with example? and interview questions on javASCRIPT
javaScript
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript
Advertisements
 

 

 

DMCA.com