
For this case to work correctly in the current bytecode world: func(a, a++) We have to put the function arguments in temporaries instead of allowing the postfix increment to modify `a` in place. This fixes a problem where jQuery.each() would skip over items.
13 lines
246 B
JavaScript
13 lines
246 B
JavaScript
test("postfix increment evaluation order", () => {
|
|
function bar(a, b) {
|
|
expect(a).toBe(0);
|
|
expect(b).toBe(0);
|
|
}
|
|
|
|
function foo() {
|
|
let i = 0;
|
|
bar(i, i++);
|
|
expect(i).toBe(1);
|
|
}
|
|
foo();
|
|
});
|