-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Bug Report
Current Behavior
Code is not logging the expected error in the browser.
Input Code
const array = [1, 2, 3];
for (const element of array) {
const from = 50;
from--;
}Expected behavior/code
The output code from Babel should log the following error Uncaught Error: "from" is read-only as I'm assigning a new value to a constant. The code without Babel would output the following Uncaught TypeError: Assignment to constant variable. which is basically the same.
The error seems to not output when the constant is defined inside a loop like the code above.
For example, if I have the following code:
const from = 50;
from--;The error would log as expected so it's just the case inside the loop.
Environment
- Babel version(s): v7.7.7
- Node/npm version: Node 12.13.1/npm 6.13.6
- OS: macOS 10.15.3
- How you are using Babel: As webpack loader
Metadata
Metadata
Assignees
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue