Skip to content

Instantly share code, notes, and snippets.

@brunosabot
Created March 30, 2022 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunosabot/59e4000e5ef58b486042bd89bb25ac84 to your computer and use it in GitHub Desktop.
Save brunosabot/59e4000e5ef58b486042bd89bb25ac84 to your computer and use it in GitHub Desktop.
const soccerTeam = [
new Goalkeeper(),
new Defender(), //...
];
const [goalkeeper, ...fieldPlayers] = soccerTeam;
// Goal keeper stay in his field
goalkeeper.stayInField();
// All field players should attack
fieldPlayers.map((player) => player.attack());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment