summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/loops/for-basic.js
blob: 8a270ddee62945215819b05b4a9f479bb189716b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
test("basic functionality", () => {
    let a = [];
    for (let i = 0; i < 3; ++i) {
        a.push(i);
    }
    expect(a).toEqual([0, 1, 2]);
});

test("only condition", () => {
    let a = [];
    for (; a.length < 3; ) {
        a.push("x");
    }
    expect(a).toEqual(["x", "x", "x"]);
});