See also: compareNoCase

Determines whether or not two strings are equal.

Syntax

JSV_compare(expS1, expS2)

Prototype

expS1.compare(expS2)

Returns

The compare function returns true if expS1 and expS2 are equal.

Parameters

The compare function uses the following arguments.

Argument Description
expS1 One of the strings that is to be evaluated for equality.
expS2 The other string that is to be evaluated for equality.

Remarks

n/a

Dependencies

n/a

Example

The following lines of code

var testString1 = "bob", testString2 = "Bob";
document.write("Is " + testString1 + " is equal to " + testString2 + "? " + 
               testString1.compare(testString2) );

var testString1 = "BOB", testString2 = "Bob";
document.write("Is " + testString1 + " is equal to " + testString2 + "? " + 
               testString1.compare(testString2) );

var testString1 = "Bob", testString2 = "Bob";
document.write("Is " + testString1 + " is equal to " + testString2 + "? " + 
               testString1.compare(testString2) );

produce