Comparison Operators in Jquery

by Vickram H 2012-09-04 00:46:11

Comparison Operators:

Comparison operators allow you to test whether values are equivalent or whether values are identical.

Sample Code:

01 var foo = 1;
02 var bar = 0;
03 var baz = '1';
04 var bim = 2;
05
06 foo == bar; // returns false
07 foo != bar; // returns true
08 foo == baz; // returns true; careful!
09
10 foo === baz; // returns false
11 foo !== baz; // returns true
12 foo === parseInt(baz); // returns true
13
14 foo > bim; // returns false
15 bim > baz; // returns true
16 foo <= baz; // returns true

Tagged in:

753
like
0
dislike
0
mail
flag

You must LOGIN to add comments