While searching for arrow functions I came across this example
let labels = [];
repeat(5, i => {
labels.push(`Unit ${i + 1}`);
});
console.log(labels);
// → ["Unit 1", "Unit 2", "Unit 3", "Unit 4", "Unit 5"]
1st, repeat method from MDN seems to accept only one parameter (count)
.
2nd, arrow functions should be written like this: i = () => {}
, and not i => {}
Is this an out of date snippet that doesn't work anyway or should I interpret it in another way?