Compare Strings in JavaScript

Posted by yhuang
Public (Editable by Users)
JavaScript
None
Edit
var s1 = "World";
var s2 = "Hello";
console.log(s1.localeCompare(s2));
console.log(s1.localeCompare('Z'));
console.log(s1.localeCompare('World'));