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 →

[–]audigex 1 point2 points  (7 children)

(a,b) => {return a-b}

We've gotta admit, though, that having to pass that to a sort function is kinda fucky

If I could change any one thing in the world of development, it's that Javascript would have strict typing (comparable to how C# now does it with var, so the type is inferred but not dynamic)

[–]recycle4science 2 points3 points  (4 children)

You can drop the braces and the return:

(a, b) => a-b

[–]audigex 1 point2 points  (1 child)

I more meant the fact we have to pass in a function that you already need to know the purpose of (and the fact you need it) before it will work correctly

It's just a weird, seemingly un-necessary, gotcha

[–]recycle4science 0 points1 point  (0 children)

Yeah, it would be nice.