Closed Bug 794065 Opened 12 years ago Closed 12 years ago

array spread operator messes up holes at the end of the literal

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: Benjamin, Unassigned)

Details

Attachments

(1 file)

var a = [1,2,3];
console.log([...a,,,,]);              // [1,2,3]
console.log([...a,,,,].length);    // 3
console.log([...a,,,,,]);             // [1,2,3,,]
console.log([...a,,,,,].length);   // 5
console.log([...a,,,,,,]);            // [1,2,3, , , ]
console.log([...a,,,,,,].length);  // 6

(Thanks Aaron Frost.)
Attachment #664484 - Flags: review?(jorendorff)
Attachment #664484 - Flags: review?(jorendorff) → review+
https://hg.mozilla.org/mozilla-central/rev/5515b887c42c
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: