You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
379 B
15 lines
379 B
function dreierPasch(wuerfelArr){
|
|
let output = 0;
|
|
let countObj = {}
|
|
for(let x of wuerfelArr){
|
|
countObj[x] = (countObj[x] || 0) + 1;
|
|
}
|
|
let vals = Object.values(countObj);
|
|
if(( vals[1] === 3) || (vals[0] === 3)|| (vals[2] === 3)){
|
|
wuerfelArr.forEach(element => {
|
|
output += element;
|
|
});
|
|
}
|
|
return output;
|
|
|
|
}
|