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

[Question] Change output formatting #588

Closed Theeverydayman closed 1 month ago

Theeverydayman commented 1 year ago

Hey, is there a way to change the number of characters displayed in the output? [is there even a limit there?]

I'm having a weird issue - I'm creating a jagged array of 1s. How I imagine it should display it in the output [single line]:

[[1,1,1],[1,1,1],[1,1,1]]

or [multiple lines, one for each inner array]:

[
 [1,1,1,1],
 [1,1,1,1],
 [1,1,1,1]
 ]

Instead it displays it like this:

 [
 [1,1,
 1,1],
 [1,1,
 1,1]
 ]

Kind of looks like there's a set max line width of some sort in the output, or is there another reason it's cutting the inner arrays in half?

Here's the code:

let map : any[] = [];

for (let i = 0; i < 10; i++)
{
    let row : number[] = [];
    for (let j=0; j<10; j++)
        {
            row.push(1);
        }
    map.push(row);
    row = [];
}

console.log(map);
lukehaas commented 1 year ago

@Theeverydayman what version of RunJS are you using?

Akawgan commented 1 year ago

Latest, at the time of writing (secondary gh)

lukehaas commented 1 year ago

I'm not able to replicate the issue. For me, the formatting looks like this:

  [
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1
  ],