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

108
Visualizações
Probability function to show how a string matches other strings based on vowels

My question is how can i make a Probability function to show how a string that i add matches other strings based on vowels

input text(reading in from the same directory and it is in columns like so)
Lorem
ipsum
dolo
  var fs = require('fs');
    var array = fs.readFileSync('input.txt').toString().split("\n");
    const asc = array.sort((a,b) => a.length - b.length);
    parts = 4;
    function splitToChunks(array, parts) {
      let result = [];
      for (let i = parts; i > 0; i--) {
         result.push(array.splice(0, Math.ceil(array.length / i)));
     }
    function isVowel(x) {
        return (/[aeiou]/i).test(x);
    }
    function countVowels(strChar, strchar2) {
        var count1 = strChar.split('').filter(isVowel).length;
        var count2 = strchar2.split('').filter(isVowel).length;

        if (count1 === count2) return strChar.localeCompare(strchar2);

        return count1 - count2
    }
    for (let i = 0; i < result.length; i++) {
        console.log(result[i].sort(countVowels));
    }
    return result;
    }
    splitToChunks(asc, 4);
about 4 years ago · Juan Pablo Isaza
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