Source code for: http://stackoverflow.com/questions/19267762/how-to-return-the-beginning-of-an-ascending-slice-of-array-in-javascript