Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

string normalize javascript

// The normalize() method returns the Unicode Normalization Form of the string.

const name1 = 'u0041u006du00e9u006cu0069u0065';
const name2 = 'u0041u006du0065u0301u006cu0069u0065';

console.log(`${name1}, ${name2}`);
// expected output: "Amélie, Amélie"
console.log(name1 === name2);
// expected output: false
console.log(name1.length === name2.length);
// expected output: false

const name1NFC = name1.normalize('NFC');
const name2NFC = name2.normalize('NFC');

console.log(`${name1NFC}, ${name2NFC}`);
// expected output: "Amélie, Amélie"
console.log(name1NFC === name2NFC);
// expected output: true
console.log(name1NFC.length === name2NFC.length);
// expected output: true
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to normalize string in javascript 
Javascript :: How to access the GET parameters after “?” in Express 
Javascript :: javascript create array with repeated values 
Javascript :: how to remove more than one attribute using jquery 
Javascript :: react port 
Javascript :: regular expression characters 
Javascript :: functional component how to add to existing array react 
Javascript :: react blur background 
Javascript :: what is virtual dom in react 
Javascript :: check Browser version js 
Javascript :: swap in javascript 
Javascript :: array every javascript 
Javascript :: how to add number in string in javascript 
Javascript :: select selected option value jquery 
Javascript :: how to call function from parent component in child component vue 
Javascript :: encrypt decrypt in vanilla javascript 
Javascript :: Return the average of the given array rounded down to its nearest integer. 
Javascript :: this element in javascript 
Javascript :: mongoose delete 
Javascript :: jquery wait for function to finish 
Javascript :: get query params react 
Javascript :: npx electron command 
Javascript :: json load 
Javascript :: html escape function javascript 
Javascript :: package.json in node js 
Javascript :: how to import svg in react 
Javascript :: javascript get black or white text base on color 
Javascript :: get current url react router 
Javascript :: EACCES: permission denied 
Javascript :: else if javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =