areEqual(value1, value2) Last updated: 17. Oct 2026

Checks if value1 and value2 are equal. Typically used to validate that two fields match (e.g. password confirmation).

Values are compared with .NET equality, not with JavaScript ==: there is no type conversion, so "1" and 1 are not equal, and two objects or arrays are equal only if they are the same instance. Two null values are equal.

See also: areNotEqual isNull assert

Parameters

Name Type Description
value1 object

Value to compare with value2.

value2 object

Value to compare with value1.

Returns

true if value1 and value2 are equal, otherwise false. Also false if not called with exactly two arguments.

Example

Data

{
"password" : "secret",
"confirm" : "secret"
}

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#docly.areEqual(password, confirm) ? "Match" : "No match"#

Output

The #JS code above produces the output shown below:
Match

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
write(docly.areEqual("abc", "abc"));
write("\n");
write(docly.areEqual(1, 2));
/* Expected output:
true
false
*/

Output

The JS code above produces the output shown below:
true
false