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

244
Views
JS - Make [].includes case sensitive

Task:

I need to check, if from given string(characters) document can be made(document) if at least 1 character is missing in characters then it is not possible to create document

Occuring problem:

When comparing 'a' and 'A' with [].includes method, it returns 'false' in the function.

Code:

function generateDocument(characters, document) {
    document = Array.from(new Set(document));
    characters = Array.from(new Set(characters));

    for(let i = 0; i < document.length; i++) {
        if(characters.includes(characters[i]) == false)
            return false;
    }
    return true;
}

console.log(generateDocument("A","a"));

Expected result: To return false, because 'a' and 'A' are not equal

about 4 years ago · Juan Pablo Isaza
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!