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

84
Visualizações
how to fetch a consonant cluster and transform the word using JavaScript function

If a word begins with a consonant, take the first consonant or consonant cluster and move to end of this word

the input of the program

blanket
sting

the output of the program

anketbl
ingst
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

First, you have to understand the meaning of the concept of "consonant cluster" linguistically: It's a consonant sequence sounds in a row. for example the word "blanket" is a consonant cluster with 2 consonant sounds "bl" .. and the word "strict" is a consonant cluster with 3 consonant sound "str" So, for words begin with consonant sounds, the sound should be moved to the end of this word. And the fetch will be based on the vowels that follow the consonant sound like this

function moveToEnd(string) {
  // the variable index is going to store the first vowel found in the string
  let index = 0;

  for (let c of string) {
    // Loop through the string until the first vowel has been found
    if ('aeiou'.includes(c)) {
      index = string.indexOf(c);
      // once we find the index of the first vowel we jump out of the loop
      break;
    }
  }
  // the new String
  return string.slice(index) + string.slice(0, index);
}
console.log(moveToEnd('blanket')) //---> output: ankletbl
about 4 years ago · Juan Pablo Isaza Relatório

0

let input = 'any string', vowel = [],consonant=[]
input.split('').forEach(e => {
if(/[aeiouwy]/gi.test(e)){
vowel.push(e)
}
else if(!/[aeiouwy]/gi.test(e)){consonant.push(e)}
})
console.log([...vowel,...consonant].toString())
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