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.

13 lines
332 B

  1. function fullHouse(wuerfelArr){
  2. let countObj = {}
  3. for(let x of wuerfelArr){
  4. countObj[x] = (countObj[x] || 0) + 1;
  5. }
  6. let vals = Object.values(countObj);
  7. if((vals[0] === 2 && vals[1] === 3) || (vals[1] === 2 && vals[0] === 3)){
  8. return 25;
  9. }
  10. return 0;
  11. }
  12. module.exports = fullHouse;