You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
4
4
5
5
## Instructions
6
6
@@ -10,11 +10,7 @@ This is an individual assessment. All work must be your own. Your challenge scor
10
10
11
11
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.
12
12
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.
18
14
19
15
## Description
20
16
@@ -28,19 +24,20 @@ Demonstrate your understanding of this week's concepts by answering the followin
28
24
29
25
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
30
26
31
-
1.Describe the biggest difference between `.forEach` & `.map`.
27
+
1.Briefly compare and contrast `.forEach` & `.map` (2-3 sentences max)
32
28
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.
34
30
35
31
3. What is closure?
36
32
37
33
4. Describe the four rules of the 'this' keyword.
38
34
39
35
5. Why do we need super() in an extended class?
40
36
41
-
## Project Set up
37
+
### Task 1 - Project Set up
42
38
43
39
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!
44
41
45
42
-[ ] Create a forked copy of this project.
46
43
-[ ] Add TL as collaborator on Github.
@@ -51,37 +48,44 @@ Follow these steps to set up and work on your project:
51
48
-[ ] Implement the project on your Branch, committing changes regularly.
-[ ] 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.
59
51
60
52
61
-
## Minimum Viable Product
53
+
### Task 2 - Minimum Viable Product
62
54
63
55
Your finished project must include all of the following requirements:
64
56
65
57
**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.**
66
58
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
70
65
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
74
70
75
-
## Task 3: Prototypes
76
71
Create constructors, bind methods, and create cuboids in this prototypes challenge.
77
72
*[ ] Use the [prototypes.js](challenges/prototypes.js) link to get started. Read the instructions carefully!
78
73
79
-
## Task 4: Classes
74
+
#### Task D: Classes
75
+
80
76
Once you have completed the prototypes challenge, it's time to convert all your hard work into classes.
81
77
*[ ] Use the [classes.js](challenges/classes.js) link to get started. Read the instructions carefully!
82
78
83
79
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.
84
80
85
-
## Stretch Problems
81
+
### Task 3 - Stretch Problems
86
82
87
83
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.
// 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.
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
+
constdisplayNames=[];
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
+
constlowCaseAnimalNames=[];
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
+
constlowPopulationAnimals=[];
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
+
constpopulationTotal=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.
/* Task 1: Study the code below and explain in your own words why nested function can access the variable internal. */
4
+
5
+
6
+
constexternal="I'm outside the function";
7
+
8
+
functionmyFunction(){
9
+
console.log(external);
10
+
constinternal="Hello! I'm inside myFunction!";
11
+
12
+
functionnestedFunction(){
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. */
0 commit comments