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

157
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 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