• Destructuring Arrays
  • Destructuring Objects
  • Spread Operator […]
  • Short Circuiting && and ||
  • Nullish Coalescing Operator (??)
<script>
  const game = {
    team1: 'Bayern Munich',
    team2: 'Borrussia Dortmund',
    players: [
      [
        'Never',
        'Pavard',
        'Martinez',
        'Alaba',
        'Davies',
        'Kimmich',
        'Goretzka',
        'Coman',
        'Muller',
        'Gnarby',
        'Lewandowski',
      ],
      [
        'Burki',
        'Schulz',
        'Hummels',
        'Akanji',
        'Hakimi',
        'Weigl',
        'Witsel',
        'Hazard',
        'Brandt',
        'Sancho',
        'Gotze',
      ],
    ],
    score: '4:0',
    scored: ['Lewandowski','Gnarby','Lewandowski','Hummels'],
    date: 'Nov 9th, 2037',
    odds: {
      team1: 1.33,
      x: 3.25,
      team2: 6.5,
    },
  };
  //1.
        const [players1, players2] = game.players;
        console.log(players1, players2);
  //2.
        const [gk, ...fieldplayers] = players1;
        console.log(gk, fieldplayers);
  //3.
        const allPlayers = [...players1, ...players2];
        console.log(allPlayers);
  //4.
        const players1Final = [...players1, 'Thiago', 'Coutinho', 'Perisic'];
        console.log(players1Final);
  //5.
        const {team1, draw , team2} = game.odds;
        //const {odds: {team1, draw, team2}} = game;
  //6.
        const printGoals = function(...players){
          console.log(players.length + 'goals were scored.');
        }
        printGoals(...game.scored);
  //7.
        team1 < team2 && console.log('Team 1 is more likely to win');
        team1 > team2 && console.log('Team 2 is more likely to win');