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)
Tracking
(Not tracked)
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
Comment 1•2 years ago
|
||
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.
Comment 2•2 years ago
|
||
Looks like Bug 1580891. Feel free to reopen the bug if it's different
Description
•