There is a need to compare two lines without case. For example, there are two lines "ivanovii" and "IvanovII" , formally, this is the same thing. It can also be like this: "Ivanovii" and "IvanovII" . In general, you need to somehow compare the string without considering the register, how can this be done?

  • 2
    bring them to one register and then compare - Grundy
  • @Grundy, hell, at the same time I wrote the answer) - Duck Learns to Take Cover
  • For example, use for each of the str.ToUpperCase lines and then compare them with each other. - BlackWitcher
  • @ Duck, you are not alone with this) - BlackWitcher

1 answer 1

Bring them to the same case.
Strings have methods toUpperCase () , toLowerCase () ;

 var myStr = 'приветики', mySecondStr = 'ПрИвЕтИкИ'; console.log(myStr.toUpperCase() === mySecondStr.toUpperCase());