Live data from Hacker News

The Birth and Death of JavaScript [video]

destroyallsoftware.com

31–40 of 236 posts

Re: The Birth and Death of JavaScript [video]

#33

> xs = ['10', '10', '10'] > xs.map(parseInt) [10, NaN, 2] Javascript is beautiful.

Just like with any language, as long as you read the docs of the stuff you use, you don't get this problem (you might get others with automatic type conversion and missing arguments like the speaker says, but not this)... this is just stupid.

Try this:

int subtract(int b, int a) { return a - b; }

int test = subtract(5, 3); // != 2, just read the damn docs

Oh, C sucks now !

The talk is quite fun and interesting to watch though.

And the end is pretty cool.

Re: The Birth and Death of JavaScript [video]

#37
post #29

> xs = ['10', '10', '10'] > xs.map(parseInt) [10, NaN, 2] Javascript is beautiful.

There are so many good WTFs in JS, but this is not one. parseInt expects 2 arguments and Array.prototype.map provides 3 to the callback it is given. Both of these facts are very well documented and known. var mappableParseInt = function(str){ return parseInt(str, 10); }; ['10', '10', '10'].map(mappableParseInt); I'd suspect this snippet is more a snipe at people who don't know JS very well and expect parseInt to be b…

You could say it's a snipe at the weak type system that Javascript has.

I dunno, as someone without much experience with Javascript, it is a little odd that arrays return the index alongside the value by default.

Re: The Birth and Death of JavaScript [video]

#38
post #32

Earlier quoted context omitted.

My scandinavian friends call it yay-va-script.

I'm Icelandic and we use yava-script, I find it hard to figure out how yay-va sounds.

YAY as opposed to nay VUH as in vagina SCRIPT pronounced normally
Post reply on HN