Tweakr
    Preparing search index...

    Function reverseWordsAdvanced

    • Reverses the order of words in a string. Handles multiple spaces and preserves punctuation placement.

      Parameters

      • input: string

        The string to reverse.

      Returns string

      The string with words reversed.

      reverseWordsAdvanced("Hello world!"); // "world! Hello"
      reverseWordsAdvanced(" One two three "); // "three two One"

      1.2.0