Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions challenges/classes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copy and paste your prototype in here and refactor into class syntax.

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

// 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.
22 changes: 22 additions & 0 deletions challenges/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

// Callbacks

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

/* Step 2: Create several functions.
The first will return the sum of two numbers.
The second will return the product of two numbers.
The third will return the modulus of the two numbers.
The fourth will return the quotient of the two numbers.
The fifth will return the square root of the two numbers.
The sixth will accept a first and last name and return 'Hey, firstName lastName, youre a wicked cool dev'.
The seventh will return whether the firstString is included the secondString.
The eigth will return whether the firstNumber is greater than the secondNumber.
The ninth will return whether the firstNumber is less than the secondNumber.
The tenth will return whether the firstNumber is greater than or equal to the secondNumber.
The eleventh will return whether the firstNumber is less than or equal to the secondNumber.
The twelvth will return whether the firstNumber is equivalent to the secondNumber.
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'
*/

// Step 3: Check your work using console.log and invoke your higher order function.
19 changes: 19 additions & 0 deletions challenges/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>

<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Jays JavaScript Challenge</title>

<script src="objects-arrays.js"></script>
<script src="functions.js"></script>
<script src="prototypes.js"></script>
<script src="classes.js"></script>
</head>

<body>
<h1>This is Jays JavaScript Challenge! Make sure that your work is checked in the console!</h1>
</body>
</html>
66 changes: 66 additions & 0 deletions challenges/objects-arrays.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Objects

// Given the following about information about animals, create some objects: name, diet, weight, length, area

// Object 1 -- dog, omnivorous, 25lb, 2ft, worldwide

// Object 2 -- tiger, carnivorous, 400lb, 6ft, india

// Object 3 -- koala, herbivorous, 40lb, 3ft, australia

/* Using the console, log the following

How much the dog weighs
What the diet of a tiger is
Where are koalas located
What is the length of all 3 objects

*/

// Create a new bark method for the dog. When called, return "Woof!"
// 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.
// Create a new climb method for the koala. When called, return "Eucalyptus is great"


// Arrays

// Given this array of game characters, complete the following tasks

const gameCharacters = [
{id: 1, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]},
{id: 2, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]},
{id: 3, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]},
{id: 4, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]},
{id: 5, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]},
{id: 6, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]},
{id: 7, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]},
{id: 8, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]},
{id: 9, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]},
{id: 10, name: "Mario", game: "Super Mario World", mission: "Save the Princess", enemy: "Bowser", subEnemies: ["Koopa", "Goomba", "BowserJr"]}
];

// 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:

// For Loop

// Map or forEach


// Step 2: Create a new array that will contain the name and mission of each character.Log the result. Solve two ways:

// For Loop

// Map or forEach


// Step 3: Find out how many sub enemies are in each character. Display the number as well as the array. Solve two ways

// For Loop

// Map or forEach

// 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:

// For Loop

// Map or forEach or filter
13 changes: 13 additions & 0 deletions challenges/prototypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* ---- LETS PRACTICE PROTOTYPES ---- */

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

// Step 1: Base Constructor -- You should create a constructor function names PentagonalPyramid that will accept properties for its length, width, and heights.

// 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)

// 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)

// Step 4: New Object -- You should create a new object that uses PentagonalPyramid. Give it the length, width, and height.

// Test your volume and surfaceArea methods here using console.log