I am not familiar with javascript at all but I have a general knowledge about programming from other languages.
Without knowing what different result you have gotten I think the different result is because in the first code block your for loop first add something to your variable “print” before writing it out on the console. The second code block you instead first write it out on the console log and then after adding something to the variable “print”.
So its all in the for loop what you start doing first in writing the code out in console or adding something to the variable.
Hope it helps and tell me if something is unclear