Skip to content

Commit 2f47eb7

Browse files
authored
Merge pull request #1239 from LambdaSchool/vnext
Vnext
2 parents 9e0ee07 + e96fa29 commit 2f47eb7

File tree

5 files changed

+134
-193
lines changed

5 files changed

+134
-193
lines changed

README.md

+28-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sprint Challenge: JavaScript Fundamentals
22

3-
This challenge allows you to practice the concepts and techniques learned over the past week and apply them in a survey of problems. This Sprint explored JavaScript Fundamentals. During this Sprint, you studied variables, functions, object literals, arrays, this keyword, prototypes, and class syntax. In your challenge this week, you will demonstrate proficiency by completing a survey of JavaScript problems.
3+
This challenge allows you to practice the concepts and techniques learned over the past week and apply them in a survey of problems. This Sprint explored JavaScript Fundamentals. During this Sprint, you studied array methods, this keyword, prototypes, and class syntax. In your challenge this week, you will demonstrate proficiency by completing a survey of JavaScript problems.
44

55
## Instructions
66

@@ -10,11 +10,7 @@ This is an individual assessment. All work must be your own. Your challenge scor
1010

1111
You are not allowed to collaborate during the Sprint Challenge. However, you are encouraged to follow the twenty-minute rule and seek support from your TL and Instructor in your cohort help channel on Slack. Your work reflects your proficiency in JavaScript fundamentals.
1212

13-
You have three hours to complete this challenge. Plan your time accordingly.
14-
15-
## Commits
16-
17-
Commit your code regularly and meaningfully. This helps both you (in case you ever need to return to old code for any number of reasons) and your team lead.
13+
> You have three hours to complete this challenge. Plan your time accordingly.
1814
1915
## Description
2016

@@ -28,19 +24,20 @@ Demonstrate your understanding of this week's concepts by answering the followin
2824

2925
Edit this document to include your answers after each question. Make sure to leave a blank line above and below your answer so it is clear and easy to read by your team lead
3026

31-
1. Describe the biggest difference between `.forEach` & `.map`.
27+
1. Briefly compare and contrast `.forEach` & `.map` (2-3 sentences max)
3228

33-
2. What is the difference between a function and a method?
29+
2. Explain the difference between a callback and a higher order function.
3430

3531
3. What is closure?
3632

3733
4. Describe the four rules of the 'this' keyword.
3834

3935
5. Why do we need super() in an extended class?
4036

41-
## Project Set up
37+
### Task 1 - Project Set up
4238

4339
Follow these steps to set up and work on your project:
40+
Make sure you clone the branch that the TK links to: the vnext branch, NOT master!
4441

4542
- [ ] Create a forked copy of this project.
4643
- [ ] Add TL as collaborator on Github.
@@ -51,37 +48,44 @@ Follow these steps to set up and work on your project:
5148
- [ ] Implement the project on your Branch, committing changes regularly.
5249
- [ ] Push commits: git push origin `<firstName-lastName>`.
5350

54-
Follow these steps for completing your project:
55-
56-
- [ ] Submit a Pull-Request to merge <firstName-lastName> Branch into master (student's Repo).
57-
- [ ] Add your team lead as a Reviewer on the Pull-request
58-
- [ ] TL then will count the HW as done by merging the branch back into master.
5951

6052

61-
## Minimum Viable Product
53+
### Task 2 - Minimum Viable Product
6254

6355
Your finished project must include all of the following requirements:
6456

6557
**Pro tip for this challenge: If something seems like it isn't working locally, copy and paste your code up to codepen and take another look at the console.**
6658

67-
## Task 1: Objects and Arrays
68-
Test your knowledge of objects and arrays.
69-
* [ ] Use the [objects-arrays.js](challenges/objects-arrays.js) link to get started. Read the instructions carefully!
59+
#### Task A: Objects and Arrays
60+
61+
Test your knowledge of advanced array methods and callbacks.
62+
* [ ] Use the [arrays-callbacks.js](challenges/arrays-callbacks.js) link to get started. Read the instructions carefully!
63+
64+
#### Task B: Closure
7065

71-
## Task 2: Functions
72-
This challenge takes a look at callbacks and closures as well as scope.
73-
* [ ] Use the [functions.js](challenges/functions.js) link to get started. Read the instructions carefully!
66+
This challenge takes a look at closures as well as scope.
67+
* [ ] Use the [closure.js](challenges/closure.js) link to get started. Read the instructions carefully!
68+
69+
#### Task C: Prototypes
7470

75-
## Task 3: Prototypes
7671
Create constructors, bind methods, and create cuboids in this prototypes challenge.
7772
* [ ] Use the [prototypes.js](challenges/prototypes.js) link to get started. Read the instructions carefully!
7873

79-
## Task 4: Classes
74+
#### Task D: Classes
75+
8076
Once you have completed the prototypes challenge, it's time to convert all your hard work into classes.
8177
* [ ] Use the [classes.js](challenges/classes.js) link to get started. Read the instructions carefully!
8278

8379
In your solutions, it is essential that you follow best practices and produce clean and professional results. Schedule time to review, refine, and assess your work and perform basic professional polishing including spell-checking and grammar-checking on your work. It is better to submit a challenge that meets MVP than one that attempts too much and does not.
8480

85-
## Stretch Problems
81+
### Task 3 - Stretch Problems
8682

8783
There are a few stretch problems found throughout the files, don't work on them until you are finished with MVP requirements!
84+
85+
## Submission Format
86+
87+
Follow these steps for completing your project:
88+
89+
- [ ] Submit a Pull-Request to merge <firstName-lastName> Branch into master (student's Repo).
90+
- [ ] Add your team lead as a Reviewer on the Pull-request
91+
- [ ] TL then will count the HW as done by merging the branch back into master.

challenges/arrays-callbacks.js

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// ==== ADVANCED Array Methods ====
2+
3+
// Given this zoo data from around the United States, follow the instructions below. Use the specific array methods in the requests below to solve the problems.
4+
5+
const zooAnimals = [
6+
{ animal_name: "Jackal, asiatic", population: 5, scientific_name: "Canis aureus", state: "Kentucky" },
7+
{ animal_name: "Screamer, southern", population: 1, scientific_name: "Chauna torquata", state: "Alabama" },
8+
{ animal_name: "White spoonbill", population: 8, scientific_name: "Platalea leucordia", state: "Georgia" },
9+
{ animal_name: "White-cheeked pintail", population: 1, scientific_name: "Anas bahamensis", state: "Oregon" },
10+
{ animal_name: "Black-backed jackal", population: 2, scientific_name: "Canis mesomelas", state: "Washington" },
11+
{ animal_name: "Brolga crane", population: 9, scientific_name: "Grus rubicundus", state: "New Mexico" },
12+
{ animal_name: "Common melba finch", population: 5, scientific_name: "Pytilia melba", state: "Pennsylvania" },
13+
{ animal_name: "Pampa gray fox", population: 10, scientific_name: "Pseudalopex gymnocercus", state: "Connecticut" },
14+
{ animal_name: "Hawk-eagle, crowned", population: 10, scientific_name: "Spizaetus coronatus", state: "Florida" },
15+
{ animal_name: "Australian pelican", population: 5, scientific_name: "Pelecanus conspicillatus", state: "West Virginia" },
16+
];
17+
18+
/* Request 1: .forEach()
19+
20+
The zoos want to display both the scientific name and the animal name in front of the habitats. Populate the displayNames array with only the animal_name and scientific_name of each animal. displayNames will be an array of strings, and each string should follow this pattern: "Name: Jackal, asiatic, Scientific: Canis aureus."
21+
22+
*/
23+
const displayNames = [];
24+
console.log(displayNames);
25+
26+
/* Request 2: .map()
27+
28+
The zoos need a list of all their animal's names (animal_name only) converted to lower case. Using map, create a new array of strings named lowCaseAnimalNames, each string following this pattern: "jackal, asiatic". Log the resut.
29+
30+
*/
31+
32+
const lowCaseAnimalNames = [];
33+
console.log(lowCaseAnimalNames);
34+
35+
/* Request 3: .filter()
36+
37+
The zoos are concerned about animals with a lower population count. Using filter, create a new array of objects called lowPopulationAnimals which contains only the animals with a population less than 5.
38+
39+
*/
40+
const lowPopulationAnimals = [];
41+
console.log(lowPopulationAnimals);
42+
43+
/* Request 4: .reduce()
44+
45+
The zoos need to know their total animal population across the United States. Find the total population from all the zoos using the .reduce() method. Remember the reduce method takes two arguments: a callback (which itself takes two args), and an initial value for the count.
46+
47+
*/
48+
const populationTotal = 0;
49+
console.log(populationTotal);
50+
51+
52+
// ==== Callbacks ====
53+
54+
/* Step 1: Create a higher-order function
55+
* Create a higher-order function named consume with 3 parameters: a, b and cb
56+
* The first two parameters can take any argument (we can pass any value as argument)
57+
* The last parameter accepts a callback
58+
* The consume function should return the invocation of cb, passing a and b into cb as arguments
59+
*/
60+
61+
62+
/* Step 2: Create several functions to callback with consume();
63+
* Create a function named add that returns the sum of two numbers
64+
* Create a function named multiply that returns the product of two numbers
65+
* Create a function named greeting that accepts a first and last name and returns "Hello first-name last-name, nice to meet you!"
66+
*/
67+
68+
69+
/* Step 3: Check your work by un-commenting the following calls to consume(): */
70+
// console.log(consume(2, 2, add)); // 4
71+
// console.log(consume(10, 16, multiply)); // 160
72+
// console.log(consume("Mary", "Poppins", greeting)); // Hello Mary Poppins, nice to meet you!
73+
74+
75+
76+
77+
/*
78+
79+
Stretch: If you haven't already, convert your array method callbacks into arrow functions.
80+
81+
*/
82+

challenges/closure.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// ==== Closures ====
2+
3+
/* Task 1: Study the code below and explain in your own words why nested function can access the variable internal. */
4+
5+
6+
const external = "I'm outside the function";
7+
8+
function myFunction() {
9+
console.log(external);
10+
const internal = "Hello! I'm inside myFunction!";
11+
12+
function nestedFunction() {
13+
console.log(internal);
14+
};
15+
nestedFunction();
16+
}
17+
myFunction();
18+
19+
// Explanation:
20+
21+
22+
/* Task 2: Counter */
23+
24+
/* Create a function called `sumation` that accepts a parameter and uses a counter to return the summation of that number. For example, `summation(4)` should return 10 because 1+2+3+4 is 10. */

challenges/functions.js

-42
This file was deleted.

challenges/objects-arrays.js

-127
This file was deleted.

0 commit comments

Comments
 (0)