cmp() method of the
interface compares two values as keys to determine equality and ordering for IndexedDB
operations, such as storing and iterating.
Note: This feature is available in Web Workers
var result = indexedDB.cmp(first, second);
The first key to compare.
The second key to compare.
An integer that indicates the result of the comparison; the table below lists the possible values and their meanings:
|-1||1st key is less than the 2nd key|
|0||1st key is equal to the 2nd key|
|1||1st key is greater than the 2nd key|
This method may raise a
DOMException of the following types:
||One of the supplied keys was not a valid key.|
var a = 1; var b = 2; var result = window.indexedDB.cmp(a, b); console.log( "Comparison results: " + result );
|Indexed Database API 3.0 (Indexed DB 3.0)|
BCD tables only load in the browser