Determining If an Object Is Equal To or Less Than Another

var x=5; var y="5"; var resultA = x==y; //Evaluates to true var result = x===y; //Evaluates to false

JavaScript uses the standard ==, !=, >, <, >=, <= operators to compare two objects. It also includes the === and !== operators that are type sensitive. For example, 1=="1" evaluates to true, whereas 1==="1" does not because the first is a numerical type and the second is a string type.

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.