Array.from({length:5},(_,i) =>
console.log(i)
);
Array.from({length: 5}, function(_, i) {
console.log(i);
});
$.each([...Array(3).keys()], (i) =>
console.log(i)
);
$.each([...Array(3).keys()], (i) => {
console.log(i);
});
$.each([1,2,3,4,5],(_,i) =>
console.log(i)
);
[...Array(5).keys()].forEach(i =>
console.log(i)
);
const num = 15;
console.log([...Array(num).keys()]);
// 1から始めたいなら
console.log([...Array(num).keys()].map(n => ++n));
$.each([...Array(fields.length).keys()], function(_,i) {
console.log(i);
})