Created
October 22, 2019 05:22
-
-
Save MidasXIV/fa919b503c95d10f6d94f3d4a3aa39c3 to your computer and use it in GitHub Desktop.
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
let pokemon = { | |
"name": "Pikachu", | |
"id": 25, | |
"type": "electric", | |
"ability": { | |
"primary": "Static", | |
"hidden": "Lightning rod" | |
}, | |
"moves": [ | |
"Quick Attack", "Volt Tackle", "Iron Tail", "Thunderbolt" | |
], | |
"competative": { | |
"weakness": ["ground"], | |
"strengths": ["water", "flying"], | |
"resistances": ["electric", "flying", "water", "steel"] | |
} | |
}; | |
const getWeakness = ({ competative: { weakness: isWeakTo } }) => { | |
return isWeakTo; | |
}; | |
const getStrengths = ({ competative: { strengths: isStrongTo } }) => { | |
return isStrongTo; | |
} | |
const getResistances = ({ competative: { resistances: isResistantTo } }) => { | |
return isResistantTo; | |
} | |
const getMoves = ({ moves }) => { | |
return moves; | |
} | |
const stat = ({ name = 'NOT DEFINED', competative: { weakness } }) => { | |
return `${name} is weak to - ${weakness}`; | |
} | |
console.log(`Weakness :: ${getWeakness(pokemon)}`); | |
console.log(`Strengths :: ${getStrengths(pokemon)}`); | |
console.log(`Resistances :: ${getResistances(pokemon)}`); | |
console.log(`Moves :: ${getMoves(pokemon)}`); | |
console.log(stat(pokemon)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment