Hi Mentee,
The for loop looks good - it starts with btnNum set to zero and increases it by one each time through, then stops looping when btnNum is 3. The tricky part here is when the different parts of code are executed. Each time through the loop the document.getElementById('btn-' + btnNum).onclick =
runs immediately with the current value of btnNum, so it finds the correct button and attaches the function to be executed when the button is clicked. However, the function it attaches is not executed until the button is clicked.
It's kinda like telling the computer "use this bag of code when the button is clicked", and the computer saying "OK, I've got the bag but I'm not going to even look inside it until I know I have to use it". When the button IS clicked, THEN the computer will try to run the code, and at that point the variables it's referencing may have different values than they did when the bag was put together.