JavaScript is case insensitive to check if strings are equal

When doing js string comparison, there is no equalsIgnoreCase() method in java to ignore case to compare whether two strings are equal, and both strings must be changed to lowercase or uppercase for comparison.

<script type="text/javascript">

vara = "aBc";

varb = "AbC";

//if(a.toUpperCase() == b.toUpperCase()) 

if(a.toLowerCase()==b.toLowerCase()) {

alert("ok");

}

</script>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325762584&siteId=291194637