mapWithIndex ()
map
With
Index
<
T
,
U
>
(
f
)
:
(
(
x
)
=>
U
[]
)
Maps over an array with index.
Type Parameters
T
U
Parameters
f
:
(
(
x
,
i
)
=>
U
)
(
x
,
i
)
:
U
Parameters
x
:
T
i
:
number
Returns
U
Returns
(
(
x
)
=>
U
[]
)
(
x
)
:
U
[]
Parameters
x
:
readonly
T
[]
Returns
U
[]
Example
mapWithIndex
((
x
,
i
)
=>
x
+
i
)([
'a'
,
'b'
])
// ['a0', 'b1']
Back to index
Maps over an array with index.