Contar los numeros postivos y sumar los negativos (+)

PHOTO EMBED

Sat May 20 2023 21:15:41 GMT+0000 (Coordinated Universal Time)

Saved by @meridaK #javascript

function countPositivesSumNegatives(input) {
    if (!input || input.length === 0) {
    return [];
    }  
  var total1 = 0;
  var total2 = 0;
  for (i = 0; i < input.length; i++) {   
    if (input[i] > 0) {                  
      total1 += 1;
    }
    if (input[i] < 0) {
      total2 += input[i];
    }
  }
  return [total1, total2];    
}
content_copyCOPY

https://www.codewars.com/users/MeridaK/completed_solutions