Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map function ignores empty items #19382

Closed
thiagomata opened this issue Mar 16, 2018 · 2 comments
Closed

Map function ignores empty items #19382

thiagomata opened this issue Mar 16, 2018 · 2 comments

Comments

@thiagomata
Copy link

thiagomata commented Mar 16, 2018

$ node -v
Version: v9.8.0
$ uname -a
Platform: Linux thiagomata 4.13.0-36-generic #40~16.04.1-Ubuntu SMP Fri Feb 16 23:25:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$ node

    var data = [];
    data[3] = 3;
    data[5] = 5;
    console.log( data.length); // 6
    console.log( data.map( x => 1 ) );

Expected:
[ 1, 1, 1, 1, 1, 1]

Result:
[ <3 empty items>, 1, <1 empty item>, 1 ]

https://repl.it/@thiagodamata/MapIngoresEmptyItems

@cjihrig
Copy link
Contributor

cjihrig commented Mar 16, 2018

Array.prototype.map() skips holes, but still has corresponding elements in the result. Node doesn't provide the implementation, so I'll close this issue, since there is nothing to be done here.

@cjihrig cjihrig closed this as completed Mar 16, 2018
@vsemozhetbyt
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants