Created
July 29, 2013 10:09
-
-
Save MACSkeptic/6103359 to your computer and use it in GitHub Desktop.
callback is invoked only for indexes of the array which have assigned values (from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1, 2].map(function (x) { return x; }) // -> [1, 2] | |
[1,, 2].map(function (x) { return x; }) // -> [1, undefined × 1, 2] | |
[1, 2].map(function () { return 'constant'; }) // -> ["constant", "constant"] | |
[1,, 2].map(function () { return 'constant'; }) // -> ["constant", undefined × 1, "constant"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment