You are reading a single comment by @abr and its replies. Click here to read the full conversation.
  • The short answer is no, it still works.

    The flow is it takes the string, pulls the number (word) or number (int) occurrences out into an object, then organises them into an array in the order they occurred in the original string, and then maps them to the relevant number. Then takes the first and last element of that array and concatenates them together. So 1 will result in an array of ['1'], so concatenating the first and last element of that array together results in 11.

    But ty for the thought.

  • Might require some refactoring, but findIndex and findLastIndex might be useful, as it means you don't need to care about any of the matches in between. Avoids most of the edge cases.

About

Avatar for abr @abr started