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

149
Visualizações
¿Hay alguna forma en que pueda fusionar todas mis funciones y for-loop en una sola función, ya que necesito que el sitio proporcione (str)?

Necesito que esto funcione sin Hard-Coding (str), sino que lo proporcione el sitio real. ¿Es posible? Sí, entiendo que mi pedido es inusual, sin embargo, funciona jajaja. Gracias por cualquier ayuda que pueda recibir. Con esta función necesito recibir una cadena de trabajos y devolver el siguiente incremento de la letra ex(a=b, b=c, e=f). También devuelve las vocales en mayúsculas. entrada: "hola 3" Salida: Ifmmp 3

entrada: "¡tiempos divertidos!" salida: gvO Ujnft!

 let str = ['f', 'u', 'n', ' ', '', 'i', 'm', 'e', 's', '!', 'n', 'n']; function replaceLetter(letter) { ///above is fixed and cannot be edited return letter.replace(/([a-zA-Z])[^a-zA-Z]*$/, function (nextLetter) { var letter = nextLetter.charCodeAt(0); switch (letter) { case 90: return 'A'; case 122: return 'a'; default: return String.fromCharCode(++letter); } }); } var vowels = 'aeiou'; let emptyStr = []; let finalStr = ''; let holder = ''; for (const i of str) { [emptyStr.push(replaceLetter(i))].join().replaceAll(',', ''); } for (let i = 0; i < emptyStr.length; i++) { if (vowels.indexOf(emptyStr[i]) >= 0) { finalStr += emptyStr[i].toUpperCase(); } else { finalStr += emptyStr[i]; } } console.log(finalStr);```
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

 var vowels = "aeiou"; let received_str = "hello"; // the dynamic string you'll recieve function replaceLetters(string) { ///above is fixed and cannot be edited let finalStr = ""; let str = [...string]; str.forEach((element) => { let nextLetter = element.replace(/([a-zA-Z])[^a-zA-Z]*$/, function ( nextLetter ) { var letter = nextLetter.charCodeAt(0); switch (letter) { case 90: return "A"; case 122: return "a"; default: return String.fromCharCode(++letter); } }); if (nextLetter !== ",") { if (vowels.indexOf(nextLetter) >= 0) { finalStr += nextLetter.toUpperCase(); } else { finalStr += nextLetter; } } }); return finalStr; } console.log(replaceLetters(received_str));

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