I have some data where I get this.
I want them to be in one array, like: ['static', 'lightning-rod']
await fetch(`${baseArgs}`).then(res => res.json()).then(res => {
const data = res
const {
abilities
} = data;
const ablength = abilities.length - 1
for (var i = 0; i <= ablength; i++) {
const abilitynames = abilities[i].ability.name
var abilitiesarr = new Array(abilitynames)
callback(abilitiesarr)
}
})
This is the code.
In the test file its:
pokeapi.PokeApi({pokemon: 'pikachu', abilities: 'names'}, res => console.log(res))