Closed Bug 1801567 Opened 1 year ago Closed 1 year ago

This code fails in the console, it does work in chrome: let arr = ["grapefruit", 4, "hello", 5.6, true]; function printStuff(element, index) { console.log("Printing stuff:", element, "on array position:", index); } arr.forEach(printStuff);

Categories

(DevTools :: Console, defect)

Firefox 107
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1580891

People

(Reporter: jdhayes.linux, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0

Steps to reproduce:

Run the following code in console fails:

let arr = ["grapefruit", 4, "hello", 5.6, true];
function printStuff(element, index) {
console.log("Printing stuff:", element, "on array position:", index);
}
arr.forEach(printStuff);

Actual results:

let arr = ["grapefruit", 4, "hello", 5.6, true];
function printStuff(element, index) {
console.log("Printing stuff:", element, "on array position:", index);
}
arr.forEach(printStuff);

Uncaught SyntaxError: redeclaration of const arr debugger eval code:1:1
<anonymous> debugger eval code:1

Expected results:

Printing stuff: grapefruit on array position: 0
Printing stuff: 4 on array position: 1
Printing stuff: hello on array position: 2
Printing stuff: 5.6 on array position: 3
Printing stuff: true on array position: 4

The Bugbug bot thinks this bug should belong to the 'DevTools::Console' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Console
Product: Firefox → DevTools

Looks like Bug 1580891. Feel free to reopen the bug if it's different

Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Duplicate of bug: 1580891
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.