Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

169
Visualizações
Comparion of 2 equal strings returns false

I am comparing the value of a checkbox with the values of strings in an array. I am printing out all the comparisons in like so:

checkSkillLevel(index: number, level: string){
console.log(this.currentAdditionalInfo.skills[index].level + "=" + level + " ?");
console.log("boolean: " + this.currentAdditionalInfo.skills[index].level == level);
}

In one of the comparisons, the value of the checkbox is "low" and the value in the array is also "low". I have also tried comparing them with ===. In both cases, it returns false, as seen in my log:

enter image description here

What is the problem here? I have tried making the exact same comparison in an online playground where it returned true.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Please make sure that both string in same case.

Also please see below code

console.log("Boolean:" + "low"=="low") --- o/p false

console.log("low"=="low") ---- o/p true

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda