Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!