FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaScript/BuildIn-Methods/map.js at master · serignembayesarr/JavaScript · GitHub
serignembayesarr
/
JavaScript
Public
forked from
lgope/JavaScript
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaScript
/
BuildIn-Methods
/
map.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
16 lines (11 loc) · 412 Bytes
Breadcrumbs
JavaScript
/
BuildIn-Methods
/
map.js
Copy path
File metadata and controls
16 lines (11 loc) · 412 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.
const
array
=
[
1
,
4
,
9
,
16
,
15
,
48
]
;
// pass a function to map
const
map1
=
array
.
map
(
ar
=>
ar
*
2
)
;
console
.
log
(
map1
)
;
// expected output: Array [2, 8, 18, 32]
function
myFunction
(
num
)
{
return
num
*
10
;
}
let
newArray
=
array
.
map
(
myFunction
)
;
console
.
log
(
newArray
)
;
Back
|
FazBrowse Home
|
New Git URL