In my application, I need to create an array starting from 1 up to a specified number, which in this case is 6, using JavaScript/TypeScript.
Here is my attempted code:
this.builder.group({
'staff': this.builder.group({
staff: [false],
id: [this.staffData[i].users[j].id],
labelName: [this.staffData[i].users[j].name],
controlname: ['staff'],
cssclass: ['error'],
checked: [false],
customcss: ['test1'],
dayid: this.selectedDay,
number: Array(this.appointmentsData.numberofSlots).fill().map((x,i) => i)})
})
However, when I check the browser console, the number is showing as 0. In VSCode, I am also getting an error stating 'expected 1-3 arguments but got 0' (I believe this is related to the fill() method where I may be passing 0 values). I am unsure of what arguments to provide for the fill() method. Can someone please assist me with this?