Coder Social home page Coder Social logo

isabellatea / pokeapibattle Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 32.0 8 KB

Utilizing PokeAPI, pull random Pokemon and battle them to determine a winner.

HTML 47.87% JavaScript 20.65% CSS 31.48%
intermediate-projects javascript javascript-practice template-strings pokeapi json

pokeapibattle's Introduction

PokeAPI Battle

  • Level: Intermediate
  • Description: Utilizing PokeAPI, pull random pokemon and battle them to determine a winner.
  • Created By: Stephanie Burgos (coach-stephanie)

Example Solution: https://coach-stephanie.github.io/pokebattle/

(Screenshot Coming Soon)

Lesson

JSON Objects

JSON Objects are typically data sets of objects within a larger object. Utilizing your knowledge of how to reference values in objects and arrays, you can access JSON data through deeper references.

Objects and For-In Loops

Objects are data structures denoted by curly brackets, and key-value pairs.

let myObject = {
  name: "bella",
  github: "isabellatea",
  number: 6,
  likesPuppies: true
  }

To reference a specific item in an object, use that item's key.

myObject["name"] // bella
myObject["github"] // isabellatea
myObject["number"] // 8
myObject["likesPuppies"] // true

Note that you can reference a value by it's key using myObject["KEY_NAME"] or myObject.KEY_NAME if the key name is known.

To loop over objects, you can use a For-In Loop (mind that it's different than a for loop for arrays):

for (var key in objectName) {
  //code to be applied to each value
}

API Introduction & PokeAPI

PokeAPI Docmentation

Challenges

  • Challenge One:

    • Write the API call similar to getRandomPokemonLeft that gets a random Pokemon for the right side.
    • Write jQuery .click() functions to execute these API calls when their corresponding “Get Random Pokmon!” buttons are clicked.
    • Confirm data is being retrieve in the console.
  • Challenge Two:

    • Utilizing the pokeData, create template strings with details of how you want each pokemon to be displayed by referencing data in it’s JSON object.
    • Append your template strings to their corresponding sides.
    • Help your neighbor! Teaching is an excellent way to test your own understanding.
  • Challenge Three:

    • The page is quite basic looking… customize your page by adding your flair to the CSS!
    • We will be working on the “Battle” mechanics and general win/lose game design algorithms next week. If you feel that you want to start this now, feel free to do so :)

Solution Gist

All Files

pokeapibattle's People

Contributors

isabellatea avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.