I actually expect that output should be 101 during the first iteration and 3 during the second iteration but it's actually -96 for both iterations. Here is the code
const arr = [];
for (var i = 100; i > 0; i = i - 99) {
arr.push(function () {
console.log(i);
});
i = i + 1;
}
arr.forEach((item) => item());