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

166
Visualizações
How mapping specific property from arraylist

I m looking a way to get all email property from my postList list to filtering max chars authorized, the problme is i don't know really how mapping email property from postList...

const postList = [
 {"postId": 1, "id": 1, "email": "Eliseo@gardner.biz"},
 {"postId": 1, "id": 2, "email": "Jayne_Kuhic@sydney.com"},
 {"postId": 1, "id": 3, "email": "Nikita@garfield.biz"},
 {"postId": 1, "id": 4, "email": "Lew@alysha.tv"},
]

const onlyEmailValid = []

for (let i = 0; i < postList.length; i++) {
   if(postList.email.value.length > max_chars) {
     console.log("email : " + postList.email + " has too long");
       continue
     }
      
     onlyEmailValid.push(postList[i]);
}
console.log(clearJobList);
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Hello try to use filter method

const postList = [
 {"postId": 1, "id": 1, "email": "Eliseo@gardner.biz"},
 {"postId": 1, "id": 2, "email": "Jayne_Kuhic@sydney.com"},
 {"postId": 1, "id": 3, "email": "Nikita@garfield.biz"},
 {"postId": 1, "id": 4, "email": "Lew@alysha.tv"},
]

const onlyEmailValid = []
const max_chars = 13
postList.filter(item=>{
    (item.email.length > max_chars) ? console.log("email : " + item.email + " has too long") : onlyEmailValid.push(item);
})

console.log(onlyEmailValid);

about 4 years ago · Juan Pablo Isaza Relatório

0

const postList = [
 {"postId": 1, "id": 1, "email": "Eliseo@gardner.biz"},
 {"postId": 1, "id": 2, "email": "Jayne_Kuhic@sydney.com"},
 {"postId": 1, "id": 3, "email": "Nikita@garfield.biz"},
 {"postId": 1, "id": 4, "email": "Lew@alysha.tv"},
]

const onlyEmailValid = []
const max_chars = 15 //example
for (let i = 0; i < postList.length; i++) {
   if(postList[i].email.length > max_chars) {
     console.log("email : " + postList[i].email + " has too long");
       continue
     }
      
     onlyEmailValid.push(postList[i]);
}
console.log(onlyEmailValid);

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