forked from isabellatea/PokeAPIBattle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
27 lines (18 loc) · 711 Bytes
/
script.js
File metadata and controls
27 lines (18 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$(document).ready(function(){
//starter function to pull a random pokemon from the PokeAPI
function getRandomPokemonLeft() {
let randomNumber = Math.floor(Math.random() * 800) + 1;
$.get(`https://pokeapi.co/api/v2/pokemon/${randomNumber}`).then(function(pokeData){
console.log("Left Pokemon Data: ", pokeData);
});
}
function getRandomPokemonRight() {
let randomNumber = Math.floor(Math.random() * 800) + 1;
$.get(`https://pokeapi.co/api/v2/pokemon/${randomNumber}`).then(function(pokeData){
console.log("Right Pokemon Data: ", pokeData);
});
}
$('#leftButton').click(getRandomPokemonLeft);
$('#rightButton').click(getRandomPokemonRight);
//all code here
})