Problems in understanding javascript nested for loops

I try to understand nested for loops in javascript but it’s very confusing.

I have this code and I can’t understand how it works:

let n = 5;
for (let i = 0; i < n; i++) {
    for (let j = 0; j < i; j++) {
    console.log(j);
}}

In console I have : 0
1
0
1
2
0
1
2
3

And I’m trying to figure out which loop represent each number.