I found normalize method on MDN.
Assume the API response from the server-side is like this: {name: "李"}. The Unicode of the 李 is \uF9E1.
Now, on client-side, can we use it in the if...else... condition like this:
// We type the '李' string, the unicode of this '李' is \u674E
if(name.normalize() === '李'.normalize()) {
// do something
}
Does String.prototype.normalize() method guarantees the same abstract character equal? So that we can compare these abstract characters in the condition with no worry.
Or, the best practice is never to return data with abstract characters in API and compare them? Instead, we should return the data from server-side like {name: '李', code: 0 } and use the code field(number data type) to compare.