Browse Source

Funktion Full House implementiert

main
Lucas Thenert 2 years ago
parent
commit
cb77aaa6b6
  1. 13
      kniffel/inc/fullHouse.js

13
kniffel/inc/fullHouse.js

@ -0,0 +1,13 @@
function fullHouse(wuerfelArr){
let countObj = {}
for(let x of wuerfelArr){
countObj[x] = (countObj[x] || 0) + 1;
}
let vals = Object.values(countObj);
if((vals[0] === 2 && vals[1] === 3) || (vals[1] === 2 && vals[0] === 3)){
return 25;
}
return 0;
}
Loading…
Cancel
Save