Contents

isEqualWithTypeCoercion(to:)

Compares the value to another for equivalence, allowing type conversion.

Declaration

func isEqualWithTypeCoercion(to value: Any!) -> Bool

Parameters

  • value:

    The value to be compared against.

Return Value

true if the values are equivalent; otherwise, false.

Discussion

This method is analogous to the equality operator == in JavaScript: it first converts its operands to the same type (if they are not already of the same type), then applies a strict equality comparison to the result. JavaScript object values are equal if and only if they refer to the same object instance.

See Also

Comparing JavaScript Values