Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

localecompare javascript

const a = 'réservé'; // with accents, lowercase
const b = 'RESERVE'; // no accents, uppercase

console.log(a.localeCompare(b));
// expected output: 1
console.log(a.localeCompare(b, 'en', {sensitivity: 'base'}));
// expected output: 0
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #localecompare #javascript
ADD COMMENT
Topic
Name
1+6 =