1
var arraySign = function (nums) {
2
// use filter to find total negative numbers in the array
3
let negativeCount = nums.filter((n) => n < 0).length;
4

5
// check if the nums array has zero. If it does, then return 0
6
if (nums.includes(0)) return 0;
7

8
// If negativeCount variable is even answer is 1 else -1
9
return negativeCount % 2 === 0 ? 1 : -1;
10
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0