Home > Article > Web Front-end > Method to compare whether strings are equal in javascript_javascript skills
I read a lot on the Internet, for example, ==.equals didn’t work
It was because of the help of foreign websites that I found a method.
http://stackoverflow.com/questions/2167602/optimum-way-to-compare-strings-in-javascript
Use the string_a.localeCompare(string_b) method to do it; it will return 3 values of 0: String equality -1: String string_a