Created
April 13, 2020 19:32
-
-
Save Nicknyr/5b7cefe9ae835031dc1005ba46d3e349 to your computer and use it in GitHub Desktop.
CodeSignal - Create Array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Given an integer size, return array of length size filled with 1s. | |
Example | |
For size = 4, the output should be | |
createArray(size) = [1, 1, 1, 1]. | |
*/ | |
function createArray(size) { | |
let arr = new Array(size).fill(1); | |
return arr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment