Last active
August 29, 2015 14:01
-
-
Save furf/924a226a5a0a91016e50 to your computer and use it in GitHub Desktop.
convert an array to a range, sorta.
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
// https://twitter.com/angustweets/status/467117418511212544 | |
var a = [1,2,3,4,5]; | |
a.map(Date.call, Number); // [0, 1, 2, 3, 4] | |
var b = []; b.length = 5; | |
b.map(Date.call, Number); // [undefined × 5] | |
var c = [,,,,,] | |
c.map(Date.call, Number); // [undefined × 5] | |
var d = [undefined, undefined, undefined, undefined, undefined]; | |
d.map(Date.call, Number); // [0, 1, 2, 3, 4] | |
var e = Array(5); | |
e.map(Date.call, Number); // [undefined × 5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment