0

I know one way to create consecutive zeros by using for loop and push method but I wonder whether there is method to create array containing consecutive zeros or number type.

looks like this Array = [0,0,0......,0] or [Numbertype, Numbertype, Numbertype,....,Numbertype]

taek
  • 3
  • 2

1 Answers1

0

You could always do something like this:

const length = 10
const value = 0
const arr = Array(length).fill(value);
PCDSandwichMan
  • 1,964
  • 1
  • 12
  • 23