well it iterates from 2 to n, and for each number i from 2 to n it also iterates from 2 to that number - 1, hence why j < i, and checks if i can be divided by j without any remainder (like if i is say 7 it checks if 7 can be divided by 2, by 3, by 4, by 5 and by 6), if it’s the case it breaks iteration of the inner loop and types out in the console what broke it and proceeds the outer loop again, it’s only allowed to alert (i) if the inner loop wasn’t broken i.e. if the number was prime
not very effective btw, you should only iterate to the square root of the number…