I am trying to make a full house combination in the game of Yahtzee. (3 of the same dice and 2 of the same)
I have a function that count occurences and will output in here after the random dice generator function:
countDice: {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0},
I want to check if the value has a 3 and a 2. And then return 25. I tried to access it with Object.values and some other ways with loops and etc. I tried it with filter but that seems to only work on an object in array and then the rest of my code messes up.
I have tried this as last :
function has(obj, value) {
for(var value in obj) {
if(this.countDice.value === 3 this.countDice.value === 2 ) {
return 25;
}
}
Nothing happens. I have been messing around with every, and some. I am stuck on a simple thing here it seems :s can anyone help me?
Aucun commentaire:
Enregistrer un commentaire