Binary search implementation in JavaScript born from a couple of my blog posts