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

152
Views
how can i get the string start with lowercase?

const arryStudent = [{
    name: 'faizan',
    rollNo: 11,
    marks: 80
  },
  {
    name: 'irfan',
    rollNo: 12,
    marks: 75
  },
  {
    name: 'Abdullah',
    rollNo: 13,
    marks: 69
  },
  {
    name: 'Asad',
    rollNo: 23,
    marks: 71
  },
  {
    name: 'ali',
    rollNo: 14,
    marks: 71
  }

];

const startsWithA = arryStudent.filter((student) => student.name.startsWith('A'));

console.log(startsWithA);

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

This is the way you can check..

    arryStudent.forEach(element => {
        if (element.name[0] == element.name[0].toLowerCase()){
         console.log(`${element.name} startswith lower case`);
      }
        if (element.name[0] == element.name[0].toUpperCase()){
         console.log(`${element.name} startswith Upper case`);
      }

    }); 
about 4 years ago · Juan Pablo Isaza Report

0

Write a function that filters out the names based on the letter.

const students=[{name:"faizan",rollNo:11,marks:80},{name:"irfan",rollNo:12,marks:75},{name:"Abdullah",rollNo:13,marks:69},{name:"Asad",rollNo:23,marks:71},{name:"ali",rollNo:14,marks:71}];


// Write a function that accepts the data,
// and the letter you're looking for
function find(arr, letter) {

  // Always lowercase the letter
  const lc = letter.toLowerCase();
  
  // And then filter out the names that match
  return arr.filter(student => {
    return student
      .name
      .toLowerCase()
      .startsWith(lc);
  });

}

console.log(find(students, 'A'));

about 4 years ago · Juan Pablo Isaza Report

0

You can use startsWith twice like:

const arryStudent = [{
    name: 'faizan',
    rollNo: 11,
    marks: 80
  },
  {
    name: 'irfan',
    rollNo: 12,
    marks: 75
  },
  {
    name: 'Abdullah',
    rollNo: 13,
    marks: 69
  },
  {
    name: 'Asad',
    rollNo: 23,
    marks: 71
  },
  {
    name: 'ali',
    rollNo: 14,
    marks: 71
  }

];

const startsWithA = arryStudent.filter((student) => student.name.startsWith('A') || student.name.startsWith('a'));

console.log(startsWithA);

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!