Skip to content

Commit 9078fa8

Browse files
authored
Merge pull request #1 from leachcoding/jay-leach
Jay leach
2 parents 42c552d + 2d98694 commit 9078fa8

File tree

5 files changed

+125
-0
lines changed

5 files changed

+125
-0
lines changed

challenges/classes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copy and paste your prototype in here and refactor into class syntax.
2+
3+
// Test the volume and surfaceArea methods using console.log. If you're unsure what the actual volumes and surfaceAreas should be, Google is once again your best friend.
4+
5+
// STRETCH: Extend the base class PentagonalPyramid with a subclass called Pyramid. Find the formulas for volume and surfaceArea for regular pyramids and create those methods using dimension properties from PentagonalPyramid. Test your work by logging out the volume and surfaceArea.

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/index.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!doctype html>
2+
3+
<html lang="en">
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
8+
<title>Jays JavaScript Challenge</title>
9+
10+
<script src="objects-arrays.js"></script>
11+
<script src="functions.js"></script>
12+
<script src="prototypes.js"></script>
13+
<script src="classes.js"></script>
14+
</head>
15+
16+
<body>
17+
<h1>This is Jays JavaScript Challenge! Make sure that your work is checked in the console!</h1>
18+
</body>
19+
</html>

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

challenges/prototypes.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* ---- LETS PRACTICE PROTOTYPES ---- */
2+
3+
// Task: You are to build a pentagonal pyramid that can return values for its volume as well as its surface areas. Follow the steps to achieve this.
4+
5+
// Step 1: Base Constructor -- You should create a constructor function names PentagonalPyramid that will accept properties for its length, width, and heights.
6+
7+
// Step 2: Volume Method -- You should create a prototype for PentagonalPyramid that returns the volume of a pentagonal pyramid. Curious about the formula??? Use Google (A DEVELOPERS BEST FRIEND)
8+
9+
// Step 3: Surface Area Method -- You should create a prototype fro PentagonalPyramid that returns the surface area of a pentagonal pyramid. Curious about the formula??? Use Google (A DEVELOPERS BEST FRIEND)
10+
11+
// Step 4: New Object -- You should create a new object that uses PentagonalPyramid. Give it the length, width, and height.
12+
13+
// Test your volume and surfaceArea methods here using console.log

0 commit comments

Comments
 (0)