Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
how to filter array items in js without filter method?

here is the question

  • Filter out companies which have more than one 'o' without the filter method
  • 0: "Facebook" 1: "Google" 2: "Microsoft" 3: "Apple" 4: "IBM" 5: "Oracle" 6: "Amazon"
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You need to loop through the array and check if each word has more than one "o".

Here is a function to verify the word:

const verif=(word)=>{
  var s=0
  var l=word.length

  for(let i=0 ; i<=l;i++) {
    if (word[i]=="o") {
      s++
    }
  }
  if (s>=2) {
    return true
  } else {
    return false
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

You can create a function a iterate through each array element

    function filterArray(arr, fn) {

    let filteredArray = [];
    for (let i = 0; i < arr.length; ++i) {
        if (fn(arr[i]) === true) {
            filteredArray.push(arr[i]);
        } 
    }
    return filteredArray;
}

function isIsogram (str) {
    return !/(.).*\1/.test(str);
}

const arr = ["Facebook", "Google", "Microsoft", "Apple", "IBM", "Oracle", "Amazon"];
console.log(filterArray(arr, isIsogram));
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda