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

160
Views
how do i that? I want the first character of the string to be uppercase and the rest lowercase

I want the first character of the string to be uppercase and the rest lowercase this is what I code

let title = prompt().toLowerCase();
for (let c of title)
{
    c[0]=c[0].toUpperCase();
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  • There are many methods, and the following is just one of them.
    function toUpperCaseFirstLetter(str) {
      if (typeof str !== 'string' || str.length === 0) {
        return str;
      }

      return str[0].toUpperCase() + str.slice(1).toLowerCase();
    }

    // some tests
    expect(toUpperCaseFirstLetter('abc')).eql('Abc');
    expect(toUpperCaseFirstLetter('ABC')).eql('Abc');
    expect(toUpperCaseFirstLetter('')).eql('');
    // other tests....
about 4 years ago · Juan Pablo Isaza 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!