lundi 6 décembre 2021

Create a function that takes a word and returns true if the word has two consecutive identical letters

// Create a function that takes a word and returns true if the word has two consecutive identical letters.

What am I doing wrong?

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;
        
    } 

};

1 commentaire:

  1. Merit Casino Bonus Code 2021 | YGGDRASIL - XN
    The bonus code, YGGDRASIL, was created by IMS Holdings, one 메리트카지노총판 of the leading suppliers of online casino games, on 제왕카지노 November 23, 2020. The bonus worrione code has

    RépondreSupprimer