Skip to content

Instantly share code, notes, and snippets.

@MidasXIV
Created October 22, 2019 05:31
Show Gist options
  • Save MidasXIV/2d212873c28bcd36300ae266b68c728a to your computer and use it in GitHub Desktop.
Save MidasXIV/2d212873c28bcd36300ae266b68c728a to your computer and use it in GitHub Desktop.

Revisions

  1. MidasXIV created this gist Oct 22, 2019.
    24 changes: 24 additions & 0 deletions for_of_destructuring.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    let pokemons = [{
    "name": "Pikachu",
    "id": 25,
    "type": "electric",
    "ability": {
    "primary": "Static",
    "hidden": "Lightning rod"
    },
    "moves": ["Quick Attack", "Volt Tackle", "Iron Tail", "Thunderbolt"]
    }, {
    "name": "Charizard",
    "id": 6,
    "type": "fire",
    "ability": {
    "primary": "Blaze"
    },
    "moves": ["flame thrower"]
    }];
    for (let { name, type, moves, ability: { primary: primaryAbility } } of pokemons) {
    console.log(`${name} is type ${type}`);
    console.log(`has moves ${moves}`);
    console.log(`Primary Ability is :: ${primaryAbility}`);
    console.log();
    }