Bug in sort function of usage example #2

urraka opened this Issue Aug 9, 2013 · 0 comments

1 participant


Not a big problem but it can be misleading. The sort function should return a value less than 0 when a goes before b, 0 when equal, and greater than 0 when a goes after b.

A correction could be something like this:

blocks.sort(function(a,b) { return (b.h - a.h); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment