lukehaas / RunJS

RunJS is a JavaScript playground for macOS, Windows and Linux. Write code with instant feedback and access to Node.js and browser APIs.
https://runjs.app
2.05k stars 45 forks source link

Loop inside a loop - is not rendered correctly in the visualizer #602

Closed ghost closed 9 months ago

ghost commented 10 months ago

Hi, when I log a loop inside a loop:

Example:

for (let exercise = 1; exercise < 3; exercise++) { console.log(---Bicep Curl ${exercise});

for (let rep = 5; rep < 6; rep++) {

  for (let set = 1; set < 4; set++) {
console.log(`set ${set} reps ${rep}`)}

  }

}

The visualizer shows it as:

'---Bicep Curl 1' '---Bicep Curl 2'

'set 1 reps 5' 'set 2 reps 5' 'set 3 reps 5' 'set 1 reps 5' 'set 2 reps 5' 'set 3 reps 5'

Instead of:

'---Bicep Curl 1' 'set 1 reps 5' 'set 2 reps 5' 'set 3 reps 5' '---Bicep Curl 2' 'set 1 reps 5' 'set 2 reps 5' 'set 3 reps 5'

lukehaas commented 10 months ago

@leonardodawinci please take a look here: https://github.com/lukehaas/RunJS/issues/497