Skip to content

Commit 2d98694

Browse files
committed
finished
1 parent 9ee26b8 commit 2d98694

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

challenges/functions.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
// Callbacks
3+
4+
// Step 1: Create a higher-order function that will accept 3 parameters. The first two can take any argument. The last is your callback. This function should return your callback that passed the first two parameters as its argument.
5+
6+
/* Step 2: Create several functions.
7+
The first will return the sum of two numbers.
8+
The second will return the product of two numbers.
9+
The third will return the modulus of the two numbers.
10+
The fourth will return the quotient of the two numbers.
11+
The fifth will return the square root of the two numbers.
12+
The sixth will accept a first and last name and return 'Hey, firstName lastName, youre a wicked cool dev'.
13+
The seventh will return whether the firstString is included the secondString.
14+
The eigth will return whether the firstNumber is greater than the secondNumber.
15+
The ninth will return whether the firstNumber is less than the secondNumber.
16+
The tenth will return whether the firstNumber is greater than or equal to the secondNumber.
17+
The eleventh will return whether the firstNumber is less than or equal to the secondNumber.
18+
The twelvth will return whether the firstNumber is equivalent to the secondNumber.
19+
The thirteenth will return a string 'Hey the number is firstNumber' if firstNumber is greater than the secondNumber. If it isn't, return a string 'Hey the number is secondNumber'
20+
*/
21+
22+
// Step 3: Check your work using console.log and invoke your higher order function.

challenges/objects-arrays.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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

Comments
 (0)