Prev Demo
Local Compare Method For Comparing The String 'A' After String 'B'.
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 = "G H I J K L"; 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