MSDotNetBuddy
The blog is to experiment with various technologies.
Search This Blog
2023/05/02
How to use reduce function to return array
var
a
=[
2
,
3
,
6
]
var
x
=
a
.
reduce
(
function
(
acc
,
val
,
index
){
acc
.
push
(
val
*
2
)
return
acc
},[])
console
.
log
(
x
)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment