function solution(number) {
var answer = 0;
const getCombinations = function (arr, selectNumber) {
const results = [];
if (selectNumber === 1) return arr.map((el) => [el]);
arr.forEach((fixed, index, origin) => {
const rest = origin.slice(index + 1);
const combinations = getCombinations(rest, selectNumber - 1);
const attached = combinations.map((el) => [fixed, ...el]);
results.push(...attached);
});
return results;
}
combinationResult = getCombinations(number, 3);
combinationResult.forEach(array => {
if(array[0] + array[1] + array[2] === 0){
answer++;
}
})
return answer;
}