Steps to get the solution: 1. Create two variables 'currentSum' to keep track of sum till current array item and 'maxSum' to keep track of maximum sum till now. 2. Loop over array items. 3.Check if currentSum is less than 0, if yes ignore the currentSum till now by making currentSum as 0. 4. Add current array item to currentSum i.e currentSum += arr[i]. 5. Store maximum of currentSum and maxSum in maxSum variable. 6. return the maxSum variable after iterating over all the items of array. Code:

function findMaxSumSubArray(arr) {
   let currentSum=0;
   let maxSum=0;
   for(let i=0;i < arr.length;i++) {
     if(currentSum < 0) {
	   currentSum = 0;
	 }
	 currentSum += arr[i];
	 maxSum = Math.max(currentSum,currentSum); 
   }
   return maxSum;
}

let arr= [2,-3,4,2]
let result = findMaxSumSubArray(arr); 
console.log('result', result); //output:  result 6