I want to get a range number array and I write this function,
public static getNumberRange(from: number, to: number): number[] {
return Array(to - from + 1).fill().map((v, i) => i + from);
}
but I got a problem, because fill() needs a parameter.
any solution??
fill- it's going to be ignored in the.mapanyway. Or you can skip the two passes and do the operations at once withArray.from({ length: to - from + 1 }, (v, i) => i + from)