Prev Demo
Local Compare Method For Comparing The Two Equal Strings.
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <p>Click the below button for comparing the two strings.</p> <input type="button" value="Compare" onclick="Function()" /> <p id="myId"></p> <script> function Function() { var a = "A B C D E F"; var b = "A B C D E F"; var r = a.localeCompare(b) document.getElementById("myId").innerHTML = r; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output