FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
stack-overflow-copy-paste/src/init-array.js at master · lintdeveloper/stack-overflow-copy-paste · GitHub
lintdeveloper
/
stack-overflow-copy-paste
Public
forked from
eggheadio-github/stack-overflow-copy-paste
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
stack-overflow-copy-paste
/
src
/
init-array.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
15 lines (14 loc) · 456 Bytes
Breadcrumbs
stack-overflow-copy-paste
/
src
/
init-array.js
Copy path
File metadata and controls
15 lines (14 loc) · 456 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
export
default
initArray
/**
* Original Source:
* http://stackoverflow.com/questions/1295584/most-efficient-way-to-create-a-zero-filled-javascript-array
*
* This method will return an array with the given length, prefilled with given value
*
*
@param
{
Number
} len - the length of the array
*
@param
{
*
} value - The value to prefill
*
@return
{
Array
} - The prefilled array
*/
function
initArray
(
len
,
value
)
{
return
new
Array
(
len
)
.
fill
(
value
)
}
Back
|
FazBrowse Home
|
New Git URL