-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 Answers1

0
const arr = new Array(255).fill(0).map((el, i) => i + 1);
Johnny Mopp
  • 12,641
  • 5
  • 36
  • 62
misha1109
  • 318
  • 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