Comparing values in JavaScript is one of the most common tasks. Yet, there are a lot of different details to bear in mind when doing so. This collection contains comprehensive explanations of the issues you may face and how to best work around them in your code.
Learn all you need to know about the differences between JavaScript's double equals and triple equals operators.
JavaScript, Type · Jun 12, 2021
Did you know there's a JavaScript value that's not equal to itself?
JavaScript, Type · Dec 12, 2021
Learn how you can compare two objects in JavaScript using various different techniques.
JavaScript, Object · Sep 26, 2021
Learn how you can compare two arrays in JavaScript using various different techniques.
JavaScript, Array · Sep 27, 2021
Learn how you can compare two dates in JavaScript using various different techniques.
JavaScript, Date · Jan 16, 2022
Object.is()
and the triple equals operator (===
) can both be used for equality checking in JavaScript, but when should you use each one?
JavaScript, Object · Jun 12, 2021
Performs a deep comparison between two values to determine if they are equivalent.
JavaScript, Object · Oct 13, 2021
Compares two objects to determine if the first one contains equivalent property values to the second one.
JavaScript, Object · Nov 3, 2020
Compares two objects to determine if the first one contains equivalent property values to the second one, based on a provided function.
JavaScript, Object · Oct 21, 2020
Checks if two arrays contain the same elements regardless of order.
JavaScript, Array · Oct 19, 2020
Checks if a date is the same as another date.
JavaScript, Date · Nov 3, 2020