Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
Cree una función que tome una palabra y devuelva verdadero si la palabra tiene dos letras idénticas consecutivas

// Crear una función que tome una palabra y devuelva verdadero si la palabra tiene dos letras idénticas consecutivas.

¿Qué estoy haciendo mal?

 module.exports = (word) => { for (let i = 0; i <= word.length; i++) { for (let j = i + 1; j <= word.length; j++) { if (word[j] == word[i]) { return true; } } return false; } };
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puedes hacer esto con solo 1 bucle.

 function hasConsecutiveIdenticalLetters(word){ for (let i = 1; i < word.length; i++) { if (word[i-1] === word[i]) { return true; } } return false; }
about 4 years ago · Juan Pablo Isaza Report

0

También puede lograr esto como a continuación usando algunos

 const hasConsecutiveIdenticalLetters = (word: string) => (word).split('').some((letter, index) => letter === word[index + 1]);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!