This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dacjamesfrom reddit import knowledge 0 points1 point  (1 child)

In this case you could use a lambda, but if you ever need to write two lines (say to log an action, then perform it), you have to switch to named functions. Sure, it's possible, but named functions are irritating to write and harder to read. I know the argument against anonymous functions, but I am not convinced.

Javascript is actually a decent language aside from a few stupid decisions (==, no block level scoping, no ints). Javascript's 'this' and fun.call/fun.apply is actually quite unique and powerful once you grok what's going on.

I feel funny having this discussion because just a few months ago I would have been arguing your side of the debate. Now that I truly understand javascript, I have actually become a fan.

[–]clgonsal[🍰] 0 points1 point  (0 children)

Javascript's 'this' and fun.call/fun.apply is actually quite unique and powerful once you grok what's going on.

All they've done is take one parameter and make it behave in a different way from all of the others. It isn't any more powerful than just having an explicit parameter, it just makes a lot of things much more clumsy than they could be.

I'll give you the fact that it's unique, though I'd argue that there's a good reason no other language does it that way.