Function replace

  • Replaces matches for pattern in string with replacement.

    Note: This method is based on String#replace.

    Parameters

    • Rest ...args: any[]
      Rest

    Returns string

    Returns the modified string.

    Since

    5.8.0

    See

    [[truncate]], [[trim]]

    Example

    replace('Hi Fred', 'Fred', 'Barney')
    // => 'Hi Barney'