What is the use of spread syntax in function while creating a new array?

30 views Asked by At

I understand about JavaScript spread syntax in general. But in the following code, I cannot understand why it is used when creating a new array of specific length:

const createArray = length => [...Array(length)];
0

There are 0 answers