Что не так с проверкой input на пустоту?
Функция не проходит тест в случае for input = []: expected [ 0, 0 ] to deeply equal []. Ожидается [ 0, 0 ] - так она это и отдает в случае input = []. Разве нет?
function countPositivesSumNegatives(input) {
var positives =0;
var negatives =0;
let resultArr = [0,0];
let i =0;
if (input===null || input.length===0){
return resultArr;
}
while (i<input.length){
if (input[i]>0) {
positives++;
}
if (input[i]<0) {
negatives = input[i]+negatives;
}
i++
}
resultArr [0]=positives;
resultArr [1]=negatives;
return resultArr;
}