I have a question about a couple of lines of code not complicated. I was just trying to execute this in JS with visual studio code:
let basket=['strawberry','peach','banana'];
for (const fruit in basket) {
basket[fruit]='apple';
console.log(basket);
}
The problem is when I ran it by pressing F5, the result is below with VS code:
(3) ['apple', 'peach', 'banana']
But when I manually executed it step by step by breaking point, the result is below:
(3) ['apple', 'peach', 'banana']
(3) ['apple', 'apple', 'banana']
(3) ['apple', 'apple', 'apple']
which is confusing, why did the execution stop at the 1st loop when debugging by F5(without breaking point)? does the code itself have a problem or is it my debugger? Thank you in advance.