- reduce<T>(str: string, fn: ((prev: T, char: string, index: number, chars: string[]) => T), initialValue?: T): T
-
Parameters
-
str: string
-
fn: ((prev: T, char: string, index: number, chars: string[]) => T)
-
- (prev: T, char: string, index: number, chars: string[]): T
-
Parameters
-
prev: T
-
char: string
-
index: number
-
chars: string[]
Returns T
-
initialValue: T = ...
Returns T
Just like array.reduce
Example