This is complete solution (src + Jasmine unit test) for:
http://stackoverflow.com/questions/19267762/how-to-return-the-beginning-of-an-ascending-slice-of-array-in-javascript
To run it just download the source code and open SpecRunner.html with a browser (tested on Firefox 34 and Chrome 38)