When studying the chapter 5 of Eloquent Javascript(a great book), I met a problem:
the example is:
let labels = ;
repeat(5, i => {
labels.push(Unit ${i + 1});
});
console.log(labels);
// → [“Unit 1”, “Unit 2”, “Unit 3”, “Unit 4”, “Unit 5”]
But when I copy the code to the chrome(latest version) console, it says:
“repeat is not defined”.
Is repeat defined as a function in a previous example in the book?
As far as I know, repeat doesn’t exist except as a string method: String.prototype.repeat().
EDIT: I found the relevant example in the book I think.