equal Function

Applies to TestComplete 14.80, last modified on April 13, 2021

The equal function compares two expressions to determine if they are equal, and returns true or false. If the compared expressions are not of the same type, TestComplete attempts to convert them to the same type (such as string, number, or boolean) before the comparison.


equal(ab) Parameters
a [in] Required Variant
b [in] Required Variant
Result     Boolean  


Due to JavaScript specifics, the equality operator == may return a wrong result if at least one of the compared values has been obtained from a TestComplete object or a COM object. For example, when you compare properties of objects in your tested application. To avoid comparison errors, use equal(a, b) instead of a==b, and !equal(a, b) instead of a!=b.


a, b

The expressions to compare.


true if the compared expressions are equal, otherwise, false.



equal(2, 2)            // true
equal(2, 2.0)          // true
equal(2, "2")          // true
equal(1, true)        // true
equal(0, false)        // true
equal(0, null)        // false
equal(0, undefined)    // false
equal(null, undefined) // true

See Also

strictEqual Function
JavaScript - Specifics of Usage

Highlight search results