Created
September 22, 2019 14:31
-
-
Save NyaGarcia/68dff90e0504c417e1c6aea2f9b186f3 to your computer and use it in GitHub Desktop.
Adding properties conditionally with if statement
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 characters
| const pokemon = { | |
| name: 'Squirtle', | |
| type: 'Water' | |
| }; | |
| const abilities = ['Torrent', 'Rain dish']; | |
| const fullPokemon = abilities ? { ...pokemon, abilities } : pokemon; | |
| console.log(fullPokemon); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment