High Order Function-"repeat is not defined"

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”.

I really don’t know what’s gone wrong.

Please help. Thanks.

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.

Add that repeat function (a simple for loop) above your code block, and your function will work as intended.

Would you like an explanation of how this all works?

Thanks for the explanation. I think that’s the reason. I will try again. I will get back to you for help if I am still confused. Thanks again.