Why is Alert breaking the cycle?

  • 0
    function sep(letters){
      if(!letters) return [];
      let arrLetters = letters.split('')
      let arrPair = []
        if(!arrLetters[i+1])  arrLetters[i+1] = '_';
      return arrPair
    sep('abc') //  ['ab', 'c_']
    sep('abcdef') //  ['ab', 'cd', 'ef']

    When we write an alert, the cycle breaks and only the first pair of letters is returned, why is this?
    JavaScript Anonymous, Oct 13, 2019

  • 1 Answers
  • 0
    He doesn't break anything. alert interrupts the code flow until OK is clicked.
    Molly Fry

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!