logoalt Hacker News

gobdovantoday at 10:43 AM1 replyview on HN

If someone does not want to check the mathematics line by line and prefers to give the article the benefit of the doubt, note that it also presents this JavaScript:

[1, 3, 2].sort((a, b) => { if (a > b) { return true

  } else {

    return false
  } 
})

This is not a valid comparator. It returns bools where the API expects a negative, zero or positive result, on my Chrome instance it returns `[1, 3, 2]`. That is roughly the level of correctness of the mathematics in the article as well, which I'm trying to present in sibling comment: https://news.ycombinator.com/item?id=47814213


Replies

zaphartoday at 11:46 AM

Why assume it is javascript? The article doesn't indicate the language anywhere that I can see.

show 1 reply