Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing parenthesis in initializer of for loop #16628

Closed
nicolo-ribaudo opened this issue Jul 10, 2024 · 0 comments · Fixed by #16630
Closed

Missing parenthesis in initializer of for loop #16628

nicolo-ribaudo opened this issue Jul 10, 2024 · 0 comments · Fixed by #16630
Assignees

Comments

@nicolo-ribaudo
Copy link
Member

Describe the bug

Babel is removing some parentheses form this for loop, and the resulting code logs 0 instead of 1

Input code

let count = 0;
for (var a = 1 || (2 in {}) in { x: 1 }) count  ;
console.log(count);

Expected behavior

Same code

Actual behavior

let count = 0;
for(var a = 1 || 2 in {} in {
    x: 1
})count  ;
console.log(count);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant