Comparing two strings : String Comparison « Data Type « JavaScript DHTML

Comparing two strings


    <title>Comparing two strings</title>
    <script type="text/javascript">
        var a = "C";
        var b = "J";
        if (a == b)
            var identity = "same";
            var identity = "different";
        document.write(a + " and " + b + ": " + identity);    


Related examples in the same category

1.Compare string against integer with a strict test
2.Compare string against integer against simple test
3.If a lower case string is greater than, equal to, or less than the same string in upper case characters.
4.Identity and Equality