|
| 1 | +// Objects |
| 2 | + |
| 3 | +// Given the following about information about animals, create some objects: name, diet, weight, length, area |
| 4 | + |
| 5 | +// Object 1 -- dog, omnivorous, 25lb, 2ft, worldwide |
| 6 | + |
| 7 | +// Object 2 -- tiger, carnivorous, 400lb, 6ft, india |
| 8 | + |
| 9 | +// Object 3 -- koala, herbivorous, 40lb, 3ft, australia |
| 10 | + |
| 11 | +/* Using the console, log the following |
| 12 | +
|
| 13 | +How much the dog weighs |
| 14 | +What the diet of a tiger is |
| 15 | +Where are koalas located |
| 16 | +What is the length of all 3 objects |
| 17 | +
|
| 18 | +*/ |
| 19 | + |
| 20 | +// Create a new bark method for the dog. When called, return "Woof!" |
| 21 | +// Create a new hunt method for the tiger. When called, if Math.random(10) is greater than 7, return "Tiger hunt successful" and add 5lb to the weight. If it is not, return "Tiger goes hungry" and subtract 5lbs to the weight. |
| 22 | +// Create a new climb method for the koala. When called, return "Eucalyptus is great" |
| 23 | + |
| 24 | + |
| 25 | +// Arrays |
| 26 | + |
| 27 | +// Given this array of game characters, complete the following tasks |
| 28 | + |
| 29 | +const gameCharacters = [ |
| 30 | + {id: 1, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]}, |
| 31 | + {id: 2, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]}, |
| 32 | + {id: 3, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]}, |
| 33 | + {id: 4, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]}, |
| 34 | + {id: 5, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]}, |
| 35 | + {id: 6, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]}, |
| 36 | + {id: 7, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]}, |
| 37 | + {id: 8, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]}, |
| 38 | + {id: 9, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]}, |
| 39 | + {id: 10, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]} |
| 40 | +]; |
| 41 | + |
| 42 | +// Step 1: Create a new array that will contain all games. Once you have it made, sort it ascending[A-Z]. Log the result. Solve two ways: |
| 43 | + |
| 44 | +// For Loop |
| 45 | + |
| 46 | +// Map or forEach |
| 47 | + |
| 48 | + |
| 49 | +// Step 2: Create a new array that will contain the name and mission of each character.Log the result. Solve two ways: |
| 50 | + |
| 51 | +// For Loop |
| 52 | + |
| 53 | +// Map or forEach |
| 54 | + |
| 55 | + |
| 56 | +// Step 3: Find out how many sub enemies are in each character. Display the number as well as the array. Solve two ways |
| 57 | + |
| 58 | +// For Loop |
| 59 | + |
| 60 | +// Map or forEach |
| 61 | + |
| 62 | +// Step 4: Find out how many missions include the term "save" (NOTE CAPITALIZATION SHOULD BE NULLIFIED IT SHOULDNT MATTER IF THE TERM HAS A CAP OR NOT). Log that result of the missions that do. Solve two ways: |
| 63 | + |
| 64 | +// For Loop |
| 65 | + |
| 66 | +// Map or forEach or filter |
0 commit comments