Home > Web Front-end > JS Tutorial > Method to compare whether strings are equal in javascript_javascript skills

Method to compare whether strings are equal in javascript_javascript skills

WBOY
Release: 2016-05-16 17:28:15
Original
1188 people have browsed it

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_astring_b You can use the correct method to compare strings in the future.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template