• Given a string with indexed tokens, performs a replacement with the tokens in the provided list. Example:

    substitute('{0}, {1}, and {2}', 'apples', 'bananas', 'pears') // 'apples, bananas, and pears'
    

    Parameters

    • str: string
    • Rest...tokens: any[]

    Returns string