Skip to content

Instantly share code, notes, and snippets.

@Nicknyr
Created April 13, 2020 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nicknyr/5b7cefe9ae835031dc1005ba46d3e349 to your computer and use it in GitHub Desktop.
Save Nicknyr/5b7cefe9ae835031dc1005ba46d3e349 to your computer and use it in GitHub Desktop.
CodeSignal - Create Array
/*
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