Created
April 22, 2022 18:24
-
-
Save James1x0/2a06e718c86263c9a7dc12ccc98fd39e to your computer and use it in GitHub Desktop.
Revisions
-
James1x0 created this gist
Apr 22, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ let currentTurn = 3; const players = [ 'you', 'someone', 'me' ]; function logCurrentPlayer () { return players[(currentTurn % players.length) - 1]; } function nextTurn () { // next turn currentTurn++; } // plays on turn players.reverse(); nextTurn(); logCurrentPlayer();