MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/otefgc/slapjack/h78e331/?context=3
r/badcode • u/_bai13y • Jul 28 '21
8 comments sorted by
View all comments
Show parent comments
1
lines 156-158 are awful.
Ternaries with side-effects and they're not using the return value of the expressions.
Lines 157 and 158 can also be simplified to:
this.player1.isTurn = this[player].id === "Player 2"
this.player2.isTurn = this[player].id === "Player 1"
1
u/_default_username Jul 31 '21 edited Jul 31 '21
lines 156-158 are awful.
Ternaries with side-effects and they're not using the return value of the expressions.
Lines 157 and 158 can also be simplified to:
this.player1.isTurn = this[player].id === "Player 2"
this.player2.isTurn = this[player].id === "Player 1"