strictEqual Function

Applies to TestComplete 15.63, last modified on April 23, 2024

Performs strict equality comparison (===). Strict comparison is only true if the compared expressions are of the same type and the contents match.

Declaration

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

Description

Due to JavaScript specifics, strict equality comparison a===b 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 strictEqual(a, b) instead of a===b, and !strictEqual(a, b) instead of a!==b.

Parameters

a, b

The expressions to compare.

Result

true if the values are strictly equal, that is, have the same type and value. Otherwise, false.

Example

JavaScript

strictEqual(2, 2)    // true
strictEqual(2, 2.0)  // true
strictEqual(2, "2")  // false
strictEqual(0, false) // false

See Also

equal Function
JavaScript - Specifics of Usage

Highlight search results