test

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
simple
const triangle = (num) => {
    for (let i = 1; i <= num; i++) {
       console.log('*'.repeat(i));
    }

    for (let j = num - 1; j > 0; j--) {
       console.log('*'.repeat(j));
    }
};


triangle(1000);
ready
complex
const x = 1000;
let triangle = '';

for (let i = 0; i <= x * 2; i++) {
    if (i <= x) {
        for (let j = 0; j < i; j++) {
            triangle += '*';
        }
    } else {
        for (let j = (x * 2) - i; j > 0; j--) {
            triangle += '*';
        }
    }
    triangle += '\n';
}

console.log(triangle);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.