kadane JavaScript implementation of Kadane algorithm http://en.wikipedia.org/wiki/Maximum_subarray_problem Returns object literal: Largest continous subarray Sum of the above mentioned subarray Link of code working in action: http://jsfiddle.net/42TA7/4/