Junior — Senior
What will the console show when calling functions from the array
livecode
Task condition
Determine what output will be displayed in the console when executing the following JavaScript code.
function makeBook() {
let book = [];
let i = 0;
while (i < 10) {
const page = function() {
console.log(i);
};
i++;
book.push(page);
}
return book;
}
let reader = makeBook();
reader[0](); // ?
reader[5](); // ?