-3

can you help me with this code? I'm new here, I'm still lost how to write code here.

    function get_array(){
    var arr [];
`enter code here`
return arr[];

}

  • 1
    [How to create an array containing 1...N](https://stackoverflow.com/a/33352604) – 001 Jan 27 '21 at 17:05

1 Answers1

0
const arr = new Array(255).fill(0).map((el, i) => i + 1);
001
  • 13,291
  • 5
  • 35
  • 66
misha1109
  • 358
  • 2
  • 5
  • Hello, can you help me, is this javascript? what is it fill and map(el) – Pablo Pinilla Duarte Jan 27 '21 at 17:04
  • it is javascript my friend:) I just created an empty array of size 255 and filled it with zeros just so i can iterate over it. then I used the current index plus 1 as the value of the new array in that index. (map function returns a new array) – misha1109 Jan 27 '21 at 17:06