title: I have a question about how the function works
body: <p>While solving the algorithm, there is a part that I do not understand about how the function works.</p>
  <pre><code>function letterCombinations(digits) {
      var map = ['0', '1', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'];
      var res = [];
      var prefix = [];
  
      if (digits.length) {
          traverse(0);
      }
      return res;
  
      function traverse(idx) {
          if (idx === digits.length) {
              return res.push(prefix.join(''));
          }
  
          var str = map[digits[idx] - '0'];
  
          for (var i = 0; i &lt; str.length; i++) {
              prefix.push(str[i]);
              traverse(idx + 1);
              prefix.pop();
          }
      }
  }
  </code></pre>
  <p>When the conditional statement inside the traverse function is encountered</p>
  <pre><code> if (idx === digits.length) {
          return res.push(prefix.join(''));
      }
  </code></pre>
  <p>Why is the pop method executed without exiting the function?</p>
  <pre><code>prefix.pop()
  </code></pre>