Skip to content

Instantly share code, notes, and snippets.

@GitSquared
Last active June 9, 2018 14:04
Show Gist options
  • Select an option

  • Save GitSquared/9c5c9fe5985a14c35e2773fc9a96ade8 to your computer and use it in GitHub Desktop.

Select an option

Save GitSquared/9c5c9fe5985a14c35e2773fc9a96ade8 to your computer and use it in GitHub Desktop.

Revisions

  1. GitSquared revised this gist Jun 9, 2018. 1 changed file with 16 additions and 1 deletion.
    17 changes: 16 additions & 1 deletion displayerTest.js
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,19 @@ let x = setInterval(() => {
    }
    i++;
    }
    }, 500);
    }, 500);

    // Expected output:

    // START
    // RUN 0: 500MS
    // -> Display left_one
    // -> Display right_one
    // RUN 1: 1000MS
    // -> Display left_two
    // -> Display right_two
    // RUN 2: 1500MS
    // -> Display left_three
    // RUN 3: 2000MS
    // -> Display left_four
    // DONE!
  2. GitSquared created this gist Jun 9, 2018.
    19 changes: 19 additions & 0 deletions displayerTest.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    console.log("START");
    let i = 0;
    let left = ["left_one", "left_two", "left_three", "left_four"];
    let right = ["right_one", "right_two"];
    let x = setInterval(() => {
    if (!left[i] && !right[i]) {
    console.log("DONE!");
    clearInterval(x);
    } else {
    console.log(`RUN ${i}: ${(i+1)*500}MS`);
    if (left[i]) {
    console.log("-> Display", left[i]);
    }
    if (right[i]) {
    console.log("-> Display", right[i]);
    }
    i++;
    }
    }, 500);