/rest-3.js Secret
Created
March 30, 2022 17:45
This file contains 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 characters
const soccerTeam = [ | |
new Goalkeeper(), | |
new Defender(), //... | |
]; | |
const [goalkeeper, defender, ...fieldPlayers] = soccerTeam; | |
// Goal keeper stay in his field | |
goalkeeper.stayInField(); | |
// One defender should also stay | |
defender.stayInField(); | |
// All the other 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