3 ms·
Gary Bernhardt's hilarious predictions [1] are truly becoming closer to completion. [1] https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascr
by franky47 4y ago
Gary Bernhardt's hilarious predictions [1] are truly becoming closer to completion.
[1] https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript https://www.destroyallsoftware.com/talks/the-birth-and-death...
- h4ch1 4y agoThanks for sharing, was a really nice watch!
- belter 4y agoMindblown that we built the Web on this... xs = ['10','10','10'] (3) ['10', '10', '10'] xs.map(parseInt) (3) [10, NaN, 2]
- franky47 4y agoFor those who may be baffled at the result, it comes from parseInt accepting two arguments (string & radix), and map providing three per iteration (the value, index and whole array). The whole array is omitted, but the radix passed to parseInt is respectively 0, 1 and 2. Valid radix values are 2 to 36, but somehow 0 is also accepted due to its falsiness, and defaults to base 10. Base 1 is definitely not valid so NaNs out, and 10 in base 2 (binary) is 2. For more of those WTF moments, in JavaScript and other languages, check out "Wat" [1], another hilarious lightning talk by Gary Bernhardt. [1] https://www.destroyallsoftware.com/talks/wat https://www.destroyallsoftware.com/talks/wat