Closed
Bug 1563354
Opened 7 years ago
Closed 7 years ago
Array.prototype.reduce()
Categories
(developer.mozilla.org Graveyard :: Collaboration, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: brizid, Unassigned)
Details
(Keywords: in-triage, Whiteboard: [specification][type:bug])
Attachments
(1 file)
|
87.44 KB,
image/png
|
Details |
What did you do?
1. Expected output with error.
What happened?
Exemple:
const array1 = [10.1, 10.2, 10.3, 10.4];
const reducer = (accumulator, currentValue) => accumulator + currentValue;
console.log(array1.reduce(reducer));
// expected output: 41
console.log(array1.reduce(reducer, 5));
// expected output: 46
What should have happened?
Present the correct result.
// Result
//> 41
//> 45.99999999999999
Is there anything else we should know?
Updated•7 years ago
|
Flags: needinfo?(cmills)
Comment 2•7 years ago
|
||
I've tested the array values you are using in Chrome and Firefox, both in the interactive MDN example, and in the devtools, and they all give the same unexpected result. So this looks more like a quirk of how JS behaves than a problem with MDN or Firefox.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(cmills)
Resolution: --- → INVALID
Updated•6 years ago
|
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•