Skip to content

Support for JS Arrays “holes”, including the test suite #39

Closed
@MaxDesiatov

Description

@MaxDesiatov

Not entirely sure how this should be handled, but JS Arrays support “holes”, where [1,,3] creates an array without anything at index 1. From the outside, that index appears to contain undefined, but array methods like map and forEach skip over those indices while iterating, and flat removes them, changing the indices of everything that comes after the hole. You can tell the difference between a hole and an undefined value with either index in array or array.hasOwnProperty(index).

I think it’s perfectly fine to simply say that holes are not handled properly since they’re quite rare in practice but I wanted to make sure this language quirk wasn’t missed.

Originally posted by @j-f1 in #38 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions